Thread Subject:
Save as a .avi, .mpg, or other vido

Subject: Save as a .avi, .mpg, or other vido

From: Jeff

Date: 19 Jun, 2010 05:00:21

Message: 1 of 3

So I have a matrix which represents the position of some masses over time. Each row is a timestep, each column is a mass. I use a loop to display one row (timestep) at a time and I get a little movie of the masses moving up and down (I probably need them to go left and right, but that's a subject for another post). I seem to recall a simple way to save that as a movie which any recorder can play, but can't remember how to do it. How can I save it as a movie?

Thanks

Here is the code (only the for, plot, and end statements are important):

for ii=1:24129
    plot(s1po(ii,:),'o');
    ax=axis;
    txt=sprintf('%d',ii);
    text(0,ax(4),txt,'BackgroundColor','white','EdgeColor','red', ...
        'VerticalAlignment','top');
    drawnow;
end

Subject: Save as a .avi, .mpg, or other vido

From: TideMan

Date: 19 Jun, 2010 05:16:25

Message: 2 of 3

On Jun 19, 5:00 pm, "Jeff " <spREMOVEHITSjef...@SIGNoptonline.net>
wrote:
> So I have a matrix which represents the position of some masses over time. Each row is a timestep, each column is a mass. I use a loop to display one row (timestep) at a time and I get a little movie of the masses moving up and down (I probably need them to go left and right, but that's a subject for another post). I seem to recall a simple way to save that as a movie which any recorder can play, but can't remember how to do it. How can I save it as a movie?
>
> Thanks
>
> Here is the code (only the for, plot, and end statements are important):
>
> for ii=1:24129
>     plot(s1po(ii,:),'o');
>     ax=axis;
>     txt=sprintf('%d',ii);
>     text(0,ax(4),txt,'BackgroundColor','white','EdgeColor','red', ...
>         'VerticalAlignment','top');
>     drawnow;
> end

help getframe
help movie2avi

Subject: Save as a .avi, .mpg, or other vido

From: Wayne King

Date: 19 Jun, 2010 10:28:05

Message: 3 of 3

"Jeff " <spREMOVEHITSjeffAT@SIGNoptonline.net> wrote in message <hvhit5$rvl$1@fred.mathworks.com>...
> So I have a matrix which represents the position of some masses over time. Each row is a timestep, each column is a mass. I use a loop to display one row (timestep) at a time and I get a little movie of the masses moving up and down (I probably need them to go left and right, but that's a subject for another post). I seem to recall a simple way to save that as a movie which any recorder can play, but can't remember how to do it. How can I save it as a movie?
>
> Thanks
>
> Here is the code (only the for, plot, and end statements are important):
>
> for ii=1:24129
> plot(s1po(ii,:),'o');
> ax=axis;
> txt=sprintf('%d',ii);
> text(0,ax(4),txt,'BackgroundColor','white','EdgeColor','red', ...
> 'VerticalAlignment','top');
> drawnow;
> end

In addition to Tideman's fine suggestions, if you have R2010a, you can look at

signalblks.MultimediaFileWriter

This object will write an AVI file on all platforms, and on Windows will write an AVI or WMV file. It is essentially a Matlab implementation of the Simulink "To Multimedia File" block.

Wayne

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us