Axis change - Is it possible to get the data of the new plot?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi,
I have a plot, for example, a surface of a sphere, and I'm changing the axis to view a semi-sphere.
Is it possible to get the data of this new plot?
Thanks
댓글 수: 0
답변 (1개)
Azzi Abdelmalek
2016년 8월 5일
편집: Azzi Abdelmalek
2016년 8월 5일
Changing the view will not change your data. If you want to get your data from the plot
plot(1:10)
h=findobj('type','line')
x=get(h,'Xdata')
y=get(h,'Ydata')
댓글 수: 4
DGM
2025년 7월 14일
In order to get things from a surface object, you need to query the surface object, not the figure.
% an example
Z = peaks(10);
hs = surf(Z);
zfromsurf = hs.ZData
Probably wasn't relevant, but for tools like fsurf() or fimplicit(), changing the view will change the data stored in the object.
% an example
hfs = fsurf(@(x,y) 5*besselj(1,hypot(x,y)));
axis equal
% for comparison
axis([-5 5, -5 5, -2 3])
drawnow
size(hfs.ZData)
% changing the view changes the data
axis([-4 4, -4 4, 0 3])
drawnow
size(hfs.ZData)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

