MATLAB: How to get a movie produced by the STREAMPARTICLES function in MATLAB 7.10 (R2010a)

animationMATLAB

I have noticed that there is no option to make STREAMPARTICLES output the movie that gets generated and is shown when STREAMPARTICLES is run. I would like to get the movie from this function to be able to save it to the .AVI file:
load wind
[sx sy sz] = meshgrid(80,20:1:55,5);
verts = stream3(x,y,z,u,v,w,sx,sy,sz);
sl = streamline(verts);
iverts = interpstreamspeed(x,y,z,u,v,w,verts,.025);
axis tight; view(30,30); daspect([1 1 .125])
camproj perspective; camva(8)
set(gca,'DrawMode','fast')
box on
h=streamparticles(iverts,35,'animate',10,'ParticleAlignment','on');

Best Answer

The ability to have movie as one of the outputs returned by STREAMPARTICLES is not available in the MATLAB 7.10 (R2010a).
To work around the issue, find modified STREAMPARTICLES function attached to the solution. STREAMPARTICLESMOD accepts 2 output arguments. As a second output it now returns a movie of the animation. In the movie animation is played once. The following example demonstrates how to use STREAMPARTICLESMOD function to get the movie and to save it to an .AVI file:
load wind
[sx sy sz] = meshgrid(80,20:1:55,5);
verts = stream3(x,y,z,u,v,w,sx,sy,sz);
sl = streamline(verts);
iverts = interpstreamspeed(x,y,z,u,v,w,verts,.025);
axis tight; view(30,30); daspect([1 1 .125])
camproj perspective; camva(8)
set(gca,'DrawMode','fast')
box on
[h M]=streamparticlesMod(iverts,35,'animate',2,'FrameRate',100,'ParticleAlignment','on');
movie(M,2,100) % play the movie. Do not close the figure window before playing the movie
movie2avi(M, 'mymovie.avi', 'fps',100,'compression', 'None')