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?

7 visualizaciones (últimos 30 días)
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]');

Respuestas (1)

Vineeth Kartha
Vineeth Kartha el 2 de Feb. de 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.

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by