Matlab Tricks
Getting datapoints from Matlab figures
11/04/09 22:27
Sometimes it’s necessary to get the data-points out of a matlab figure (though it typically happens years after the original was made and with no scripts to rerun). I can never seem to remember how to do this. I found a good description posted elsewhere on a blog called Memming’s Inconsistency. Since I’m not sure how inconsistent that source will be in the future, I’ll put the commands here too.
Basics :
>>axes_loc =get(gcf,’Children);
>>info=get(axes_loc(1),’Children&rsquo
>>get(info)
will then provide a huge list of the properties in the 1st plot on the figure.
x_data = get(info,’XData&rsquo
that’ll do it. For plots with multiple curves, you’ll need to pull them out from arrays, but by this point it’s within my ability to remember. The above is what I can never seem to recall and always resort to Google searches to find.