MATLAB: How to create n arrays from a mxn matrix using mat2dataset

arrays from matrixmat2dataset

Hi guys,
I'm using mat2dataset on a 100×100 matrix and i want to create 100 arrays of each column of the dataset. This is what i'm doing:
% y=100x100 matrix
s=mat2dataset(y);
y1=(ds.y1);
y1=y1.';
y2=(ds.y2);
y2=y2.'; ... %and so on
There must be a way to do this avoiding writing every single array!
Hope you can help me
Thanks!

Best Answer

DON'T DO THIS.
Seriously, DO NOT DO THIS.
See question 1 in the Programming section of the FAQ for more information about why this is a Bad Idea. Dynamic field names (described in the FAQ question) work for dataset arrays just like they do for struct arrays, if I remember correctly.