Indexing structure without using scalars
Show older comments
Consider following structure:
mm(1,1).no=1;
mm(2,1).no=2;
mm(3,1).no=3;
mm(3,1).mtx=[3;3;3];
mm(2,1).mtx=[2;2;2];
mm(1,1).mtx=[1;1;1];
a1 = cat(1, mm([1,2]).no)
a1 =
1
2
a2 = cat(1, mm([1,2]).mtx(1))
Scalar index required for this type of multi-level indexing.
Is there a work-around for this type of indexing?
Accepted Answer
More Answers (1)
Matt J
on 31 Oct 2012
tmp=cat(1,mm([1,2]).mtx);
a2=tmp(1)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!