MATLAB: Can you use the concatenation ability of MATLAB to combine a 3×4 and a 3×5 matrix

matrix array

If yes, how we can do this?

Best Answer

Yes you can, as long as the row or column dimensions matches.
A = zeros(3, 4) % A 3x4 matrix
B = ones(3, 5) % a 3x5 matrix
AB = cat(2, A, B) %Concatenate along column dimension (dim = 2), resulting in a 3x9 matrix
AB = [A B] %Same thing as cat(2, A, B)