3D animation of imported data
Mostrar comentarios más antiguos
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
1 comentario
Peter Fraser
el 16 de Jun. de 2016
Respuestas (1)
Nut
el 16 de Jun. de 2016
0 votos
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 comentario
Peter Fraser
el 16 de Jun. de 2016
Categorías
Más información sobre Animation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!