How to plot the content of a Structure without using a for loop?

5 views (last 30 days)
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.
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!

Accepted Answer

Ahmet Cecen
Ahmet Cecen on 6 Apr 2018
Edited: Ahmet Cecen on 6 Apr 2018
Yes, in a way that is not apparent at first look, but very simple when you think about it:
I believe you can figure out the rest after this critical piece of information.
David Franco
David Franco on 6 Apr 2018
It worked with your suggestion plus buffer function:
a = [pop.Position];
b = buffer(a,2)';
Because using just [pop.Position] a get an 1xN vector. That's why it wasn't working.
Many thanks!

Sign in to comment.

More Answers (0)


Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!