problem using trisurf in a gui

3 visualizaciones (últimos 30 días)
Toby Tyrrell
Toby Tyrrell el 31 de Jul. de 2025
Comentada: Toby Tyrrell el 31 de Jul. de 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

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Legend en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by