REPMAT

Purpose:

Replicates an array down and across.

Syntax:

REPMAT(a, down, across)

a

-

An array.

down

-

An integer, the number of times to replicate the rows (downward).

across

-

Optional. An integer, the number of times to replicate the columns (across). Defaults to down.

Returns:

An array of replicated columns and rows.

Example:

W1: {{1, 2, 3},

     {4, 5, 6}, 

     {7, 8, 9}} 

 

W2: repmat(W1, 2, 3)

 

W2 == {{1, 2, 3, 1, 2, 3, 1, 2, 3},

       {4, 5, 6, 4, 5, 6, 4, 5, 6}, 

       {7, 8, 9, 7, 8, 9, 7, 8, 9}, 

       {1, 2, 3, 1, 2, 3, 1, 2, 3}, 

       {4, 5, 6, 4, 5, 6, 4, 5, 6}, 

       {7, 8, 9, 7, 8, 9, 7, 8, 9}} 

Example:

W1: {{1, 2, 3},

     {4, 5, 6}, 

     {7, 8, 9}} 

 

W1: repmat(10, size(W1))

 

W2 == {{10, 10, 10},

       {10, 10, 10}, 

       {10, 10, 10}} 

Example:

a = repmat(100, 3, 2)

 

a == {{100, 100},

      {100, 100}, 

      {100, 100}} 

Remarks:

REPMAT(a, {down, across}) is equivalent to REPMAT(a, down, across).

 

REPMAT(scalar, N, M) returns an NxM array where each element is the scalar value.

 

REPMAT(scalar, size(array)) returns an array where each element is the scalar value and the output dimensions are the same as the input array.

See Also:

RAVEL

REPCOLUMN

REPELEMENTS

REPLICATE