I'm trying to get the data from a zoomed-in MATLAB figure. I was able to get the XData and YData of the full field of view figure, as well as the XLim and YLim of the zoomed-in figure, but no more than that. Can someone advise me please?

6 views (last 30 days)
h=get(Fig1);
axesObjs = get(h.Children); % axes handles dataObjs = axesObjs.Children; objTypes = get(dataObjs, 'Type'); % type of low-level graphics object xdata = get(dataObjs, 'XData'); % data from low-level grahics objects ydata = get(dataObjs, 'YData'); %% Zooming in axesObjs_crop = get(gcf); dataObjs_crop = axesObjs_crop.Children; objTypes_crop = get(dataObjs_crop, 'Type'); % type of low-level graphics object xlim = get(dataObjs_crop, 'XLim'); ylim = get(dataObjs_crop, 'YLim'); Fig2=figure(2); axis([xlim(1),xlim(2),ylim(1),ylim(2)]) hold on plot(xdata,ydata,'*') xlabel('X [nm]'); ylabel('Y [nm]');

Answers (1)

Vineeth Kartha
Vineeth Kartha on 2 Feb 2016
Hi Guy Nir,
Refer the Axes properties and Chart Line properties in MATLAB documentation to get a list of all the properties associated with an axes and line object.
Now make use of the get command to retrieve the necessary information from the figure.
For example,
>> linewidth = get(dataObjs,'Linewidth');
>> color = get(dataObjs,'Color');
returns the Linewidth and the Color of the low-level graphic object, respectively.

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!