Is it possible to save plotted points?
Show older comments
The general idea is that I am plotting a parabola and using 'r.' to plot it in red dots.
Is there a way I can save these dot/points? I need the location, and I am randomly generating the parabola so this would definitely be ideal.
If not, could I have a suggestion to best do what I am hoping to acheive? I am sure more info is needed, so please ask away and I can clarify.
Answers (1)
Rik
on 19 Aug 2020
0 votes
Either save the data you use to create the plot, or retrieve that data from the XData and YData properties of the line object created by plot.
7 Comments
Kayleigh Movalli
on 19 Aug 2020
Rik
on 19 Aug 2020
What code are you using to create the plot?
Kayleigh Movalli
on 24 Aug 2020
Rik
on 24 Aug 2020
So why can't you save x and y directly? Anyway, the code below shows what I mean.
h=plot(x,y);
x=h.XData;y=h.YData;
Adam Danz
on 24 Aug 2020
Kayleigh Movalli
on 25 Aug 2020
Adam Danz
on 25 Aug 2020
If you weren't expecting imaginary components, that's usually a sign that something in your analysis isn't working the way it's intended. You could extract the real part using real(x) which is 0 but I doubt that would address the real problem, unless you're expecting a complex number.
Categories
Find more on Line Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!