Print screen of an excel worksheet using a matlab script?

2 ビュー (過去 30 日間)
Andy
Andy 2012 年 4 月 25 日
Hi
Does anyone know how to do a screen capture / print screen of an excel worksheet using a matlab script?
I have a script that sends a lot of information to an excel worksheet, I then need this information to be saved as an image file (with the excel formatting). This all has to be done automatically so I can't just manually take a printscreen, it must be part of my script
thanks
Andy

採用された回答

TAB
TAB 2012 年 4 月 25 日
As far as I know, there is no direct cammand in MATLAB to to take screenshot.
You can try below piece of code for it. (Copied from here)
robo = java.awt.Robot;
t = java.awt.Toolkit.getDefaultToolkit();
%# Set the capture area as the size for the screen
rectangle = java.awt.Rectangle(t.getScreenSize());
%# Get the capture
image = robo.createScreenCapture(rectangle);
%# Save it to file
filehandle = java.io.File(sprintf('capture%d.jpg', i)); javax.imageio.ImageIO.write(image,'jpg',filehandle);
Also, there are lots of free print screen utilities available on internet like this one.
Install any such utility and run it from MATLAB using dos() or system() command.
  2 件のコメント
TAB
TAB 2012 年 4 月 25 日
FileEx. contributions
http://www.mathworks.com/matlabcentral/fileexchange/11363-screencapture/content/ScreenCapture.m
http://www.mathworks.com/matlabcentral/fileexchange/22031-getscreen
Andy
Andy 2012 年 4 月 25 日
Thankyou, works great!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by