To append matrices in Matlab, you can use concatenation. There are two types of concatenation: horizontal concatenation and vertical concatenation.
Horizontal concatenation is used to append matrices horizontally, side by side. This can be done using the square bracket notation:
main.m97 chars4 lines
The resulting matrix C
will be a 2x4 matrix.
Vertical concatenation is used to append matrices vertically, one on top of the other. This can also be done using the square bracket notation:
main.m44 chars2 lines
The resulting matrix D
will be a 4x2 matrix.
In both cases, it's important to make sure the matrices have the same dimensions along the dimension you wish to concatenate.
gistlibby LogSnag