3D animation of imported data
Afficher commentaires plus anciens
I'm trying to animate a 16 x 16 pressure map. The pressure data are imported as num_frames * 16 by 16 array. I reshape it to a 16 by 16 by num_frames array, and use "surf" to display it. I have two problems. I want to be able to rotate the view in real time, but I can't work out how to do that. The animation runs OK without messing with the azimuth and elevation, but when I add the azimuth and elevation I get "too many output arguments" with the "[az, el] = view" line.
P = permute(reshape(out', 16, 16,[]),[2,1,3]);
clearvars out
dims = size(P)
num_frames = dims(3)
[az, el] = deal(-30, 30) % initial view direction
for frame = 1:num_frames
surf(P(:, :, frame))
view = [az, el]
axis([1 16 1 16 0 max(max(max(P)))])
[az, el] = view %update view direction
pause(0.05)
end
The other problem is that I need the "pause" command for it to animate(without the [az, el] stuff. Is it just running too fast without the pause? How to I correctly synchronize the rendering to the monitor display rate?
Thanks
Réponses (1)
Nut
le 16 Juin 2016
0 votes
Hi,
I'm not able to answer your question, I'm writing just for a suggestion. I never used the "drawnow" function, but I know that it is often used when an animation is needed. So, I think it may be helpful for you, try to read about it:
1 commentaire
Peter Fraser
le 16 Juin 2016
Catégories
En savoir plus sur Animation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!