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 次查看(过去 30 天)
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]');

回答(1 个)

Vineeth Kartha
Vineeth Kartha 2016-2-2
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.

类别

Help CenterFile Exchange 中查找有关 Graphics Object Properties 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by