I have a structure which contains various arrays. I want to directly access a particular element of an array. My structure is as follows: s =
a: [1 2 3 4 5] b: [1 2 3 4 5] . .Now I want to access elements of these arrays(a,b...) in loop. So how can I access that. I am able to access complete array using below commands:fields = fieldnames(s);
for i=1:length(fields)
s.(fields{i});
end
But I am not able to access a particular element directly in one command. How can I do that?
Best Answer