In MATLAB, to horizontally concatenate two arrays with different sizes, you need to make sure that one dimension of both arrays is same. For example, if you have an array of size [3 2] and another array of size [3 1], then you need to make sure that the first dimension is same, i.e., 3 in this case.
Here's an example:
main.m172 chars11 lines
In the above example, a is a 3x2 matrix and b is a 3x1 matrix. We can horizontally concatenate a and b by using the horzcat function. The output c is a 3x3 matrix, where the first two columns are from a and the last column is from b.
gistlibby LogSnag