MATLAB: How to perform a screen capture using MATLAB 7.7 (R2008b)

MATLABscreenshot

I would like to be able to do programmatic screen capturing from within MATLAB.

Best Answer

The ability to do a screen capture is not available in MATLAB 7.7 (R2008b).
To work around this issue, you may try using the 'createScreenCapture' method from Java's 'Robot' class. This example takes a screen capture of a 300-by-300 pixel area in the upper left corner of the screen and writes it to a PNG-file.
r = java.awt.Robot
bimg = r.createScreenCapture(java.awt.Rectangle(0, 0, 300, 300))
f = java.io.File('screenshot.png')
javax.imageio.ImageIO.write(bimg, 'png', f)