Hi everyone,
I am currently working on a gui interface, in which I am plotting a 3D animation of vehicles within a loop. At each iteration, i plot several items, such as the posiiton of each vehicle, their velocity vectors, the vehicles themselves, etc..
Some of these items need to stay on the figure, but most of these need to be deleted after each iteration.
The best way to do this that i have found to give the plot i need to delete a particular display name, and then delete the corresponding items at the end of the loop :
quiverEnemyVehicle = quiver3(enemy_x, enemy_y, enemy_z, enemy_u, enemy_v,enemy_w, 5, 'DisplayName', 'deleteAfterRefresh');
...
delete(findobj(handles.axes1, 'DisplayName', 'deleteAfterRefresh'));
However, as my simulation is quite long (about 3000 iterations of the loop), the longer it goes the slower the function findobj gets, making the display really slow.
I have tried other methods, like assigning each plot to a variable in my handles, and then trying to delete it :
quiverEnemyVehicle = quiver3(enemy_x, enemy_y, enemy_z, enemy_u, enemy_v,enemy_w, 5);
field = sprintf('plot_%i', handles.simulation.plot_index);
handles.simulation.(field) = quiverEnemyVehicle;
handles.simulation.plot_index = handles.simulation.plot_index + 1
...
for j=1:handles.simulation.plot_index
plot_name = sprintf('handles.simulation.plot_%i', j);
delete(plot_name);
end
However this solution doesn't seem to be working, as the corresponding items do not disappear from my GUI interface.
Do you have any idea of the best way to do that ?
Thanks,
Lilian