array in array struct
1 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1403274/image.png)
i want element (1:10) of each fields..
f(1:end).F(1:10)
Intermediate dot '.' indexing produced a comma-separated list with 73 values, but it must produce a single value when followed by
subsequent indexing operations.
0 个评论
回答(1 个)
Stephen23
2023-6-5
编辑:Stephen23
2023-6-5
"i want element (1:10) of each fields.."
Your structure only has one field, named "F".
You can iterate over the 73 elements of that structure using a loop or ARRAYFUN:
C = arrayfun(@(s)s.F(1:0),f,'uni',0)
3 个评论
Stephen23
2023-6-5
编辑:Stephen23
2023-6-5
"With many fields what would it look like?"
Exactly the same, if you only want the values from one of those fields.
"if i write gg=[f.FF] it's similar?"
That creates a comma-separated list as inputs to the concatenation operator, so you end up with all content of the FF field horizontally concatenated. Perhaps you could use this, but it does not match the description in your question.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!