- the size, which determines what indexing you can use.
- the fields, which determines what field names you can use.
Access Field from Struct
124 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I need your help with accessing a field from a struct. I am not really familiar with how to use structs.
I got this struct (not mine, therefore I don't really know how to properly work with it) and just want to plot the values that are in the first column.
There is probably a really easy way how to do it. I tried to access the data with something like a=structname.MeansArea, but this gives me only the very first entry of the column. I apprechiate all help.
1 个评论
Stephen23
2020-9-25
编辑:Stephen23
2020-9-25
Structure arrays have two independent features which need to be considered when accessing their data:
For non-scalar structures you will likely find comma-separated lists to be very useful:
It is also possible to access the fieldnames dynamically:
采纳的回答
Ameer Hamza
2020-9-25
编辑:Ameer Hamza
2020-9-25
You need to use concatenation brackets [ ]
a=[structname.MeansArea]
更多回答(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!