I have a structure where every field is an array of the same length. I need to pass this structure on but only with a single element in each field. I thought of doing it this way
A.b = [1:10];
A.c = [2:11];
A.d = [3:12];
a = structfun(@(x) x(1),A)
but this results in
The answer I want for the first element is
I will want to run this in a for loop for use in the next function like this
for ii = 1:length(A.b)
...
a = structfun(@(x) x(ii),A);
nextfcn(a);
...
end