2

I would like to use getframe to capture a screenshot of my nice GUI object, which I created using GUIDE. I can't just use OS PrintScreen functionality because I need to make a movie of something that happens in the GUI window, i.e. capture thousands of frames.

However, since a GUIDE object is apparently not a normal figure (this can be demonstrated by getframe(gcf), which cheerfully opens a new, empty 'Figure 1' window), I'm at a loss what handle I might use to have getframe() capture the contents of my GUI window.

Any ideas?

Jonas Heidelberg
  • 4,984
  • 1
  • 27
  • 41
Matt Mizumi
  • 1,193
  • 1
  • 11
  • 27
  • Note: I tried using findobj() to hunt for a handle to my GUIDE object, but no luck. Maybe I'm not using the right thing to search on, though. – Matt Mizumi Jun 22 '11 at 20:48

1 Answers1

2

I'm guessing that the 'HandleVisibility property of your GUIDE GUI figure is set to 'off', which would keep its handle from being found by functions like FINDOBJ. However, you can use the function FINDALL to find the hidden handle of your GUI figure, then pass that handle to GETFRAME instead of gcf. For example, if your GUI figure has the title 'My GUI', you could do this:

hFigure = findall(0,'Name','My GUI');
frameData = getframe(hFigure);
gnovice
  • 125,304
  • 15
  • 256
  • 359