How to plot the content of a Structure without using a for loop?
4 次查看(过去 30 天)
显示 更早的评论
I need to plot the content of a structure fiel:
Each row in the column Position is made by 2 elements (x and y). I need to plot all the rows at once on a scatter plot.
Using:
pop(1).Position(1)
I can access the first value of the first row/column. But I would like to plot all the column values without using a for loop.
Is that possible?
Thanks in advance!
0 个评论
采纳的回答
Ahmet Cecen
2018-4-6
编辑:Ahmet Cecen
2018-4-6
Yes, in a way that is not apparent at first look, but very simple when you think about it:
[pop.Position]
I believe you can figure out the rest after this critical piece of information.
3 个评论
Ahmet Cecen
2018-4-6
编辑:Ahmet Cecen
2018-4-6
Its just:
[pop.Position]
Do that and check the answer. A simple reshape will solve your problem after that.
Edit: Fixed Braces.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!