Is it possible to easily combine values from struct array fields into a single array without looping through each individual struct in the array?
For reference, see the attached code:
% build random struct array with only one field
% for demonstration only
clear i s out;
for i = 1:10
s(i).value = rand;
end
s
% not working, as it returns multiple results
s(1:end).value
% combine all "value" into a single array using for-loop
out = zeros(length(s), 1);
for i = 1:length(s)
out(i) = s(i).value;
end
out
Simply put, the goal is to kind of "merge" all "value" fields.