How to plot the content of a Structure without using a for loop?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
David Franco
am 6 Apr. 2018
Kommentiert: David Franco
am 6 Apr. 2018
I need to plot the content of a structure fiel:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171869/image.png)
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 Kommentare
Akzeptierte Antwort
Ahmet Cecen
am 6 Apr. 2018
Bearbeitet: Ahmet Cecen
am 6 Apr. 2018
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 Kommentare
Ahmet Cecen
am 6 Apr. 2018
Bearbeitet: Ahmet Cecen
am 6 Apr. 2018
Its just:
[pop.Position]
Do that and check the answer. A simple reshape will solve your problem after that.
Edit: Fixed Braces.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!