Is there a way to convert a double array to a struct array and place it under one field?
For example, suppose we get a double array from a call of cellfun and the output array looks like
data=[1,2;3,4];
Can we get a struct S where
S=struct;
for i=1:numel(data)
S(i).data=data(i);
end
end
with native functions or just get S efficiently? (visual at the end)
If there is a method, can the resultant struct array preserve the dimensions of the original double array? Can the method apply to output of cellfun where the output is a double array?
In my particular application, my data is the (uniform) output of a call to cellfun and when I set S.data=cellfun(...), the result is a 1-element struct array where S.data is the m-by-n double array from cellfun(...). What can I do to distribute the array elements?
(My task at hand involves processing 10k data points per query and for each task, it's about 16 queries. So speed is important. If there is no efficient method, I'll know to avoid struct for this particular type of tasks. So comments on that front is helpful too.)
