How can I access the nth element of all the arrays in a structure of arrays?
Show older comments
I have a structure with M fields, and I wish each field to contain an array of N elements. I wish to access the data for each field in one call (plane organization), but I am loading data to the structure on an element-by-element basis.
example:
S.f1=zeros(1,10)
S.f2=ones(1,10)
X.f1=55
X.f2=56
I want to assign X to the second element of all fields of S so that S.f1 contains 0,55,0,0,0,0,0,0,0,0 S.f2 contains 1,56,1,1,1,1,1,1,1,1
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!