problem using trisurf in a gui

14 Ansichten (letzte 30 Tage)
Toby Tyrrell
Toby Tyrrell am 31 Jul. 2025
Kommentiert: Toby Tyrrell am 31 Jul. 2025
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

Akzeptierte Antwort

Matt J
Matt J am 31 Jul. 2025
Bearbeitet: Matt J am 31 Jul. 2025
The "hold on" command doesn't prevent it from starting afresh every time.
Use,
hold(ax2,'on')

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by