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!