I have a set of data that is <106x25 double> but this is inside a struct and I want to extract the data into a matrix. I figured a simple FOR loop would accomplish this but I have hit a road block quite quickly in my MATLAB knowledge.
This is the only piece of code I have, but I just don't know enough about MATLAB to get this simple bit of code working:
>> x = zeros(106,25); for i = 1:106, x(i,:) = [s(i).surveydata]; end
??? Subscripted assignment dimension mismatch.
's'
is a very very large file (in excess of 800MB), it is a <1 x 106 struct>
. Suffice it to say, I just need to access a small portion of this which is s.surveydata
where most rows are a <1 x 25 double> (a row vector IIRC) and some of them are empty and solely return a []
.
s.surveydata
obviously returns the results for all of the surveydata
contained where s(106).surveydata
would return the result for the last row. I therefore need to grab s(1:106).surveydata
and put it into a matrix x
. Is creating the matrix first by using x = zeros(106,25)
incorrect in this situation?
Cheers and thanks for your time!
Ryan