I have a 14 x 13 matrix of doubles and I need to loop through this matrix and save each column into a separate one-dimensional array.
Currently I have the following code:
for i = 1:14
for j = 1:13
if i == 1
A(1, j) = M(1, j)
elseif i == 2
B(1, j) = M(2, j) ...
end
end
end
This works only for the first row and I don't see how conceptually this would be correct. I don't think you need to create a separate array manually...
What is the best way to do this?