I Have a 8x18 structure with each cel containing a column vector of occurrences of a single event. I want to obtain data from some of these fields concatenated in a single array, without having to loop through it. I can't seem to find a way to vertically concatenate the fields I am interested in in a single array.
As an example I create the following structure with between 1 and 5 occurrences per cell:
s(62).vector(8,18).heading.occurrences=[1;2;3];
for i=1:62
for j=1:8
for k=1:18
y=ceil(rand(1)*5);
s(i).vector(j,k).heading.occurrences=rand(y,1);
end
end
end
Now i want to obtain all occurrences in several cells while keeping i constant at for instant i=1. What I have tried is:
%fields of interest
a=[1 26 45];
x=[s(1).vector(a).heading.occurrences];
This however yields the error: Expected one output from a curly brace or dot indexing expression, but there were 3 results.
Is there anyone how to do this without having to loop through the whole structure?