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!