MATLAB: How to make a vector from the elements in the same position across many matrices

MATLABmatricesposition;vector

I have 736 matrices of size 72×144. I want to find a vector of 736×1, where each element of the new vector represents the element from the same position in each of the original matrices.
For example:
A = [ 1 2 3 | 4 5 6 | 7 8 9 ]
B = [ 2 2 2 | 3 3 3 | 4 4 4 ]
C = [ 5 4 3 | 1 2 3 | 5 6 7 ]
Want:
D4 (position 2,1) = [ 4 3 1 ]
D5 (position 3,2) = [ 8 4 6 ]
What is the easiest way for me to do this? I can do it manually, but it will take me all weekend. Please help!

Best Answer

Dear Patrick, you can do it as follows:
NumberOfMatrices = 736;
A = randi(100, 72, 144, NumberOfMatrices); % Your 736 matrices
for i = 1:NumberOfMatrices
B{i} = reshape(A(:,:,i)', 1, []);
end
C = reshape((cell2mat(B)), [], NumberOfMatrices); % Each row of C represent one vector of length 736 from corresponding values from 736 matices
I hope it helps. Good luck!