How to export Saved figure data points to Matlab work space?

  • Follow


Hello.
 I have a saved matlab figure. I want to have the Y-axis data points and X-axis data points in the work space. for example assume I have already plotted y=2x for x=1:1:100. now I only have the saved figure. how can i extract x=[1:1:100] and y=[2:2:200]  from that saved figure?  Is there any solution to do so?

Thank you!
0
Reply Sina 10/21/2010 8:27:07 PM

"Sina 2010" <si.mashayekhi@gmail.com> wrote in message <i9q7mr$7f2$1@fred.mathworks.com>...
> Hello.
>  I have a saved matlab figure. I want to have the Y-axis data points and X-axis data points in the work space. for example assume I have already plotted y=2x for x=1:1:100. now I only have the saved figure. how can i extract x=[1:1:100] and y=[2:2:200]  from that saved figure?  Is there any solution to do so?
> 
> Thank you!

When you open the figure, the function gca will return the handle to the axis. You can then get handles for all the lines using the call
line_handles = get(gca,'children')
Then for each line on the plot
x = get(line_handles(1),'xdata');
y = get(line_handles(1),'ydata');

Amy
0
Reply Amy 11/9/2010 7:02:05 PM


"Amy" <aleisha1112@hotmail.com> wrote in message <ibc5rc$ii$1@fred.mathworks.com>...
> "Sina 2010" <si.mashayekhi@gmail.com> wrote in message <i9q7mr$7f2$1@fred.mathworks.com>...
> > Hello.
> >  I have a saved matlab figure. I want to have the Y-axis data points and X-axis data points in the work space. for example assume I have already plotted y=2x for x=1:1:100. now I only have the saved figure. how can i extract x=[1:1:100] and y=[2:2:200]  from that saved figure?  Is there any solution to do so?
> > 
> > Thank you!
> 
> When you open the figure, the function gca will return the handle to the axis. You can then get handles for all the lines using the call
> line_handles = get(gca,'children')
> Then for each line on the plot
> x = get(line_handles(1),'xdata');
> y = get(line_handles(1),'ydata');
> 
> Amy

Hi Amy,

Could you please let me know how we can retrieve the data itself from the figure? Thanks,

Shahed
0
Reply Shahed 12/15/2010 3:16:05 PM

2 Replies
2854 Views

(page loaded in 0.023 seconds)

Similiar Articles:













7/20/2012 12:24:18 PM


Reply: