Reputation: 287
I have a 13x13x100 array, L, of doubles that I write out using csvwrite(L, 'file.csv');
. This produces a csv with 13 rows and 1300 columns, so using M=csvread('file.csv');
gives a 13x1300 array. Is there a smarter way to write this out or read this in so that M = L? Alternatively, is there an easy way to convert M from 13x1300 to 13x13x100?
Upvotes: 1
Views: 1421
Reputation: 2131
You can use the reshape()
function to convert M as you describe
M = reshape(M, [13 13 100]);
The matrix elements are assigned column-wise, which is almost certainly what you want. Check the help for reshape()
Upvotes: 2