problem using trisurf in a gui

조회 수: 3 (최근 30일)
Toby Tyrrell
Toby Tyrrell 2025년 7월 31일
댓글: Toby Tyrrell 2025년 7월 31일
Hi,
I’ve got a problem with using trisurf to plot to a set of axes on a panel on a gui. It worked fine before when I was plotting onto a standalone figure but not now I am trying to plot onto a set of axes that are on a panel inside a gui.
I want to draw multiple objects onto the same plot inside a loop. If I do it as shown below then trisurf ignores the previous axes(ax2) command and does not plot onto ax2 but rather creates a new figure and draws on that.
axes(ax2) % ax2 is the handle for the axes inside the GUI
for jj = 1:bb
% other code not shown
[aaa,bbb] = convhull(vx, vy, vz);
trisurf(aaa,vx,vy,vz)
hold on
end
On the other hand, if I manually tell it which axes to draw on, as below, then it does plot on ax2 but it clears the axes every time before drawing the next object, so it only draws one object a time rather than all together on the same plot. The "hold on" command doesn't prevent it from starting afresh every time.
trisurf(aaa,vx,vy,vz,'Parent',ax2)
hold on
Any ideas would be appreciated on how to get round this

채택된 답변

Matt J
Matt J 2025년 7월 31일
편집: Matt J 2025년 7월 31일
The "hold on" command doesn't prevent it from starting afresh every time.
Use,
hold(ax2,'on')
  댓글 수: 1
Toby Tyrrell
Toby Tyrrell 2025년 7월 31일
Many thanks, this solved it

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by