access structure fields without loop
1 次查看(过去 30 天)
显示 更早的评论
hi guys,
Assume structure A has a field called "name".
I want to get the first 100 elements of "name".
Can i do it without loop?
Thanks in advanced.
0 个评论
回答(2 个)
Paulo Silva
2011-8-16
Catch each name into a cell
B={A(1:100).name};
If can get any name into a string like this
B{1}
0 个评论
Walter Roberson
2011-8-16
Paulo's answer might well be what is required, but the question is ambiguous. Another possible interpretation would be
A.name(1:100)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!