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

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

Post by Sina 201 » Sat, 23 Oct 2010 05:27:07


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!
 
 
 

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

Post by Amy » Thu, 11 Nov 2010 04:02:05


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

 
 
 

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

Post by Shahe » Fri, 17 Dec 2010 00:16:05


Hi Amy,

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

Shahed