Hi. I was not able to find an answer to my question, so I am asking it here. Is there a more direct way to get an array of all elements of a structure.field?
What I want is a direct one-liner which gives me the same as:
for ii = 1:length(Results)
Test(ii,1) = Results(ii).end_dates;
end
(Test is a 222x1 array)
something like:
Test = Results(:).end_dates
whereby this line somehow just gives me Results(1).end_dates, so just the first element of the field...
This is my structure: (a little bit small here, so also as an attachement)
2 Comments
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/450059-how-to-get-an-array-of-all-field-elements-of-a-1xn-structure#comment_681031
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/450059-how-to-get-an-array-of-all-field-elements-of-a-1xn-structure#comment_681031
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/450059-how-to-get-an-array-of-all-field-elements-of-a-1xn-structure#comment_681040
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/450059-how-to-get-an-array-of-all-field-elements-of-a-1xn-structure#comment_681040
Sign in to comment.