In MATLAB, you can define an extended matrix by concatenating two or more matrices horizontally or vertically using the square bracket notation. To concatenate two matrices horizontally, use the command horzcat
. To concatenate two matrices vertically, use the command vertcat
.
Here is the syntax to define an extended matrix by concatenating three matrices horizontally:
main.m73 chars5 lines
And here is the syntax to define an extended matrix by concatenating two matrices vertically:
main.m51 chars4 lines
You can use the same commands to concatenate more than two matrices as well.
gistlibby LogSnag