MATLAB: How to get the Xdata and Ydata from a figure using MATLAB 2015b

.fig filesfindobjhandle graphicsxdata

Recently upgraded to Matlab 2015b and the handle graphics seems to have changed from the older versions. How do I get the Xdata and Ydata from a figure?

Best Answer

It’s changed, but it’s still available:
figure(1)
plot(x, y) % Plot Your Favourite (x,y) Values
grid
savefig('TestFig.fig');
clearvars, clf, cla % Be Certain All Are Cleared
openfig('TestFig.fig');
hp = findobj(gca,'Type', 'line');
xd = get(hp, 'XData');
yd = get(hp, 'YData');