Expert Answer:
:
Just use indexing:
>> s(1,1,1).data = [1 2 3 4]; >> s(1,1,2).data = [10 20 30 40 50]; %// example struct >> s(1,1,2).data(3) ans = 30 >> s(1,1,2).data(2:4) ans = 20 30 40
Also, it's better not to use struct
as a variable name, because struct
is a built-in function.