REPMAT for repeating array patterns

repmat is used for producing repeating matrix in matlab arrays.

Syntax

repmat( <matrix>, <number of rows> , <number of columns>)

Example

>> repmat([ 1 2 3], 3 , 5)

ans =

     1     2     3     1     2     3     1     2     3     1     2     3     1     2     3
     1     2     3     1     2     3     1     2     3     1     2     3     1     2     3
     1     2     3     1     2     3     1     2     3     1     2     3     1     2     3

>> repmat([ 1 2 3], 3 , 2)

ans =

     1     2     3     1     2     3
     1     2     3     1     2     3
     1     2     3     1     2     3

>> a = [2 3; 6 9]

a =

     2     3
     6     9

>> repmat(a,2,3)

ans =

     2     3     2     3     2     3
     6     9     6     9     6     9
     2     3     2     3     2     3
     6     9     6     9     6     9
Share

You may also like...