problem using trisurf in a gui

3 次查看(过去 30 天)
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')

更多回答(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