Reputation: 208
I have an array of possibly million 3x3 matrices. What would be the fastest way to horizontally concatenate them in MATLAB without using for loop? Ideally I would like to do something simple like this
[M(:,:,1) M(:,:,2) ... M(:,:,10000000)]
Upvotes: 1
Views: 104
Reputation: 26069
the way the question is put is to convert a big 3-D matrix M(:,:,j)
to a concatenated 2-D one.
For that just use reshape
, for example:
M=reshape(M,size(M,1),[]);
Upvotes: 5