MATLAB Programming/Advanced Matrix Operations

Category:Book:MATLAB Programming#Advanced%20Matrix%20Operations%20

Advanced Array Operations

This section is a toolbox of special array operations. These operations may be rare; however, a use may arise in specialized situations.

Row Replication, Column Replication, and Tiling

To replicate a columns, rows, or to create tiles repmat.

Tiling example:

 >> a = [1,2;3,4]
 a =
 1     2
 3     4
 >> repmat(a,2)
 ans =
 1     2     1     2
 3     4     3     4
 1     2     1     2
 3     4     3     4

Column Replication example:

 >> b = [1;2;3]
 b =
 1
 2
 3
 >> repmat(b,[1,3])
 ans =
 1     1     1
 2     2     2
 3     3     3
Category:Book:MATLAB Programming