How can I orbit a plot3 via mouse while updating it?
Mostra commenti meno recenti
I have a plot that I want to be able to orbit with my mouse while it's updating. But every update to the plot forces the plot to go back to it's default view point. Is there a way to do what I want?
Thanks in advance!
Risposta accettata
Più risposte (1)
2 Commenti
Dereck
il 12 Set 2014
Geoff Hayes
il 13 Set 2014
Strange how it slowed down over time. Was it necessary for the set(0, 'CurrentFigure', 1); inside the for loop so that it would repeat again and again?
An alternative to the deleting of the handle is to (perhaps) just replace the data at each iteration
figure(1);
% plot the first set of data outside of loop
h = plot3(X(1,:), Y(1,:), Z(1,:));
for k=2:100000
set(h,'XData',X(k,:),'YData',Y(k,:),'ZData',Z(k,:));
drawnow;
pause(0.1);
end
So we plot the first set (k==1) initially so that we can get the handle to the 3D plot graphics object. And then on each subsequent iteration of the for loop, we just replace the X,Y, and Z data.
Categorie
Scopri di più su Discrete Data Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!