Return the concatenation of N-d array objects, array1, array2, ..., arrayN along dimension dim.
A = ones (2, 2); B = zeros (2, 2); cat (2, A, B) ans = 1 1 0 0 1 1 0 0Alternatively, we can concatenate A and B along the second dimension the following way:
[A, B].dim can be larger than the dimensions of the N-d array objects and the result will thus have dim dimensions as the following example shows:
cat (4, ones(2, 2), zeros (2, 2)) ans = ans(:,:,1,1) = 1 1 1 1 ans(:,:,1,2) = 0 0 0 0