In MATLAB, horzcat
is a function used to horizontally concatenate arrays. It is used to combine arrays of the same size along their columns.
Here is the syntax for using horzcat
:
main.m18 chars2 lines
A
and B
are the arrays that you want to concatenate. C
is the resulting concatenated array.
Here is an example to demonstrate the usage of horzcat
:
main.m62 chars4 lines
The resulting array C
will be:
main.m45 chars3 lines
Note that horzcat
works only when the arrays have the same number of rows.
Remember to make sure that the size of the arrays is compatible for concatenation when using horzcat
.
Hope this helps!
gistlibby LogSnag