Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Using Getframe for Pcolor plot ?? please help - should be easy

Subject: Using Getframe for Pcolor plot ?? please help - should be easy

From: Yoichi

Date: 30 Jul, 2009 17:05:19

Message: 1 of 8

Hi,
I am using Matlab 7.9 R2009b and the ever popular Windows Vista.

I am trying to make a movie of my pcolor plots and have created a simple test code to see what the issue is. When I run this code only the first frame is captured and copied for all 30 "frames" I put in the pause because i thought it might help magically but it didnt and it is not necessary.

I just want to see what happens on other peoples machine when they run this...do i have some major misunderstanding about getframe capabilities? is the pcolor plot not the correct format? Or is it only a problem on my version/OS?
I am quite confused and any help would be great! THanks!!!!

  for i = 1:30
         
         M = rand(30);
         pcolor(M);
         pause(0.1);
         Image(i) = getframe(gca);

         
    end

    movie(Image);

Subject: Using Getframe for Pcolor plot ?? please help - should be easy

From: us

Date: 30 Jul, 2009 17:14:03

Message: 2 of 8

"Yoichi " <yoichishiga@gmail.com> wrote in message <h4sjsf$3kd$1@fred.mathworks.com>...
> Hi,
> I am using Matlab 7.9 R2009b and the ever popular Windows Vista.
>
> I am trying to make a movie of my pcolor plots and have created a simple test code to see what the issue is. When I run this code only the first frame is captured and copied for all 30 "frames" I put in the pause because i thought it might help magically but it didnt and it is not necessary.
>
> I just want to see what happens on other peoples machine when they run this...do i have some major misunderstanding about getframe capabilities? is the pcolor plot not the correct format? Or is it only a problem on my version/OS?
> I am quite confused and any help would be great! THanks!!!!
>
> for i = 1:30
>
> M = rand(30);
> pcolor(M);
> pause(0.1);
> Image(i) = getframe(gca);
>
>
> end
>
> movie(Image);

copy/pasting this snippet makes exactly what you think it should...
therefore, you're probably not giving CSSM the whole story...

us

Subject: Using Getframe for Pcolor plot ?? please help - should be easy

From: someone

Date: 30 Jul, 2009 17:31:18

Message: 3 of 8

"Yoichi " <yoichishiga@gmail.com> wrote in message <h4sjsf$3kd$1@fred.mathworks.com>...
> Hi,
> I am using Matlab 7.9 R2009b and the ever popular Windows Vista.
>
> I am trying to make a movie of my pcolor plots and have created a simple test code to see what the issue is. When I run this code only the first frame is captured and copied for all 30 "frames" I put in the pause because i thought it might help magically but it didnt and it is not necessary.
>
> I just want to see what happens on other peoples machine when they run this...do i have some major misunderstanding about getframe capabilities? is the pcolor plot not the correct format? Or is it only a problem on my version/OS?
> I am quite confused and any help would be great! THanks!!!!
>
> for i = 1:30
>
> M = rand(30);
> pcolor(M);
> pause(0.1);
> Image(i) = getframe(gca);
>
>
> end
>
> movie(Image);

On Windows XP with MATLAB R2007b, I get:

>> Image

Image =

1x30 struct array with fields:
    cdata
    colormap

>> isequal(Image(1).cdata,Image(30).cdata)

ans =

     0

Subject: Using Getframe for Pcolor plot ?? please help - should be easy

From: Yoichi

Date: 30 Jul, 2009 18:15:20

Message: 4 of 8

"someone" <someone@somewhere.net> wrote in message <h4sld6$n1e$1@fred.mathworks.com>...
> "Yoichi " <yoichishiga@gmail.com> wrote in message <h4sjsf$3kd$1@fred.mathworks.com>...
> > Hi,
> > I am using Matlab 7.9 R2009b and the ever popular Windows Vista.
> >
> > I am trying to make a movie of my pcolor plots and have created a simple test code to see what the issue is. When I run this code only the first frame is captured and copied for all 30 "frames" I put in the pause because i thought it might help magically but it didnt and it is not necessary.
> >
> > I just want to see what happens on other peoples machine when they run this...do i have some major misunderstanding about getframe capabilities? is the pcolor plot not the correct format? Or is it only a problem on my version/OS?
> > I am quite confused and any help would be great! THanks!!!!
> >
> > for i = 1:30
> >
> > M = rand(30);
> > pcolor(M);
> > pause(0.1);
> > Image(i) = getframe(gca);
> >
> >
> > end
> >
> > movie(Image);
>
> On Windows XP with MATLAB R2007b, I get:
>
> >> Image
>
> Image =
>
> 1x30 struct array with fields:
> cdata
> colormap
>
> >> isequal(Image(1).cdata,Image(30).cdata)
>
> ans =
>
> 0


Thanks, I am glad it is not the code. I am hoping my real program will be fine, Ill just try it out on another machine.

While this does leave me a bit lost - I wonder if anyone has run code this using Vistax64? I am a skeptical Vista user, and want to see if that has anything to do with it? I wish I had more of a story but I don't....not sure what I do from here though? any advice?

Subject: Using Getframe for Pcolor plot ?? please help - should be easy

From: us

Date: 30 Jul, 2009 18:51:01

Message: 5 of 8

"Yoichi "
> Thanks, I am glad it is not the code. I am hoping my real program will be fine, Ill just try it out on another machine.
>
> While this does leave me a bit lost - I wonder if anyone has run code this using Vistax64? I am a skeptical Vista user, and want to see if that has anything to do with it? I wish I had more of a story but I don't....not sure what I do from here though? any advice...

again, as both someone and i told you: the snippet works just fine and as expected...
it certainly has nothing(!) to do with your OS, no matter which one you use:
- you simply ask ML to fill an array of 30 members with 30 different values...

the only other thing i can imagine is a GPU problem; however, since you added the PAUSE statement already, it was understood that you saw the image changing its content appropriately...
in addition, you could do this

     pause; % <- now you have to continue manually...
     ie=isequalwithequalnans(Image(1).cdata,Image(i).cdata);
if ie % <- they are equal...
     keyboard;
% to examine your array more closely...
end

altogether, i'm almost sure, though, you're not giving CSSM the whole story...

us

Subject: Using Getframe for Pcolor plot ?? please help - should be easy

From: Yoichi

Date: 30 Jul, 2009 19:20:19

Message: 6 of 8

"us " <us@neurol.unizh.ch> wrote in message <h4sq2l$n9c$1@fred.mathworks.com>...
> "Yoichi "
> > Thanks, I am glad it is not the code. I am hoping my real program will be fine, Ill just try it out on another machine.
> >
> > While this does leave me a bit lost - I wonder if anyone has run code this using Vistax64? I am a skeptical Vista user, and want to see if that has anything to do with it? I wish I had more of a story but I don't....not sure what I do from here though? any advice...
>
> again, as both someone and i told you: the snippet works just fine and as expected...
> it certainly has nothing(!) to do with your OS, no matter which one you use:
> - you simply ask ML to fill an array of 30 members with 30 different values...
>
> the only other thing i can imagine is a GPU problem; however, since you added the PAUSE statement already, it was understood that you saw the image changing its content appropriately...
> in addition, you could do this
>
> pause; % <- now you have to continue manually...
> ie=isequalwithequalnans(Image(1).cdata,Image(i).cdata);
> if ie % <- they are equal...
> keyboard;
> % to examine your array more closely...
> end
>
> altogether, i'm almost sure, though, you're not giving CSSM the whole story...
>
> us

Hey thanks for the help. When I changed my monitor colar quality settings to 16bit instead of 32bit it started working!!!! Im sorry if it seemed like i was not telling you the whole story, i was truly stumped?! but again thanks and all is well now!!!

thanks!

Subject: Using Getframe for Pcolor plot ?? please help - should be easy

From: Mike

Date: 5 May, 2012 00:48:28

Message: 7 of 8

"Yoichi" wrote in message <h4srpj$f39$1@fred.mathworks.com>...
 
> Hey thanks for the help. When I changed my monitor colar quality settings to 16bit instead of 32bit it started working!!!!

I know this is a reply to an old thread but I wanted to add that I just had the exact same problem as Yoichi (when creating a movie using getframe, only the first frame is recorded for the entire movie). I also changed my display settings to 16 bit instead of 32 bit and it fixed the problem. I'm stumped as to why this fixed the problem, but it did...

Subject: Using Getframe for Pcolor plot ?? please help - should be easy

From: Dmitry

Date: 4 Apr, 2013 11:27:19

Message: 8 of 8

Hi, guys

It's 2013 but the problem stays the same. I'm using Laptop which had run Vista and now i'm using Win7, but movie keeps recording only the first frame when in 32 color mode. Switching mode to 16 color solves the problem!

Tags for this Thread

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.

Contact us