How do I get the Xdata and Ydata from a figure using MATLAB 2015b?
59 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
Star Strider
2015-9-10
编辑:Star Strider
2015-9-10
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');
4 个评论
Andreas
2020-9-28
Dummy question: how can you update XData and YData after e.g. cleaning up raw data?
set(??)
Star Strider
2020-9-28
Not ‘dummy’ at all!
I would just re-plot them.
However you can always do something like this as well:
set(hp, 'XData',newXdata);
set(hp, 'YData',newYdata);
Note that I did not test that, however it should work.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!