Indexing structure array. Every first entry of an vector.
古いコメントを表示
Hello, I have stored a lot of vectors in the fields of an structure array and i want to get every first element. s is an 1xN struct. field1 contains the vector
a = s(1:end).field1(1)
or
a = s.field1(1)
give the same error "Expected one output from a curly brace or dot indexing expression, but there were N results."
1 件のコメント
Stephen23
2018 年 10 月 25 日
"Expected one output from a curly brace or dot indexing expression, but there were N results."
Because you are generating a comma-separated list:
採用された回答
その他の回答 (1 件)
Walter Roberson
2018 年 10 月 25 日
arrayfun(@(S) S.field1(1), s)
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!