Screenshot entire window in AppDesigner

106 ビュー (過去 30 日間)
Christian
Christian 2019 年 5 月 20 日
コメント済み: Adam Danz 2024 年 3 月 15 日
Hello everybody,
I'm currently building an app using AppDesigner. I want to implement a button, which captures a screenshot from the entire app after it's been pressed. So that I can compare different sets of data afterwards with just a quick look on their screenshots.
Unfortunately I cannot come up with an idea on how to make Matlab screenshot my entire app window. In a regular Matlab script I use the ScreenCapture function from FileExchange, but this seems not to work within AppDesigner.
imageData = screencapture(gcf,[],'myFigure.jpg');
Any suggestions on how to do this?
Since I have multiple tabs it would be ideal to come up with an idea on how to "screenshot" every tab with just one press of a button.
Cheers, Christian
  1 件のコメント
Kristin Schall - van Bellen
Kristin Schall - van Bellen 2020 年 7 月 17 日
Does anybody know how it's working by now?

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

回答 (1 件)

Adam Danz
Adam Danz 2020 年 11 月 1 日
Starting in Matlab r2020b, you can take snapshots of an app / uifigure using the functions below.
See demos:
  7 件のコメント
Dorian
Dorian 2024 年 3 月 8 日
編集済み: Dorian 2024 年 3 月 8 日
Hello,
I am using the exportapp function with Matlab R2023a and screenshoting my app does not work while having a very simple class :
function JourButtonPushed(app, event)
exportapp(app,'file.png');
end
It says "Specified handle is not valid for export." and there are no mentions of being able to capture the app itself in the help pages for exportapp or getframe. I have also directly tried the example shown in the link you sent, and app.MyApp (after changing MyApp to my actual app name) still claims that "MyApp" is an undefined class, property or field. Am I doing something wrong or were there changes in the most recent versions that hindered the compatibility ? While unrelated I have also experienced such issues with some app components not posessing an Alpha variable for transparency despite older posts being able to handle the transparency of the same components this way, so this is why I think the newer versions may have changed this aswell ?
Adam Danz
Adam Danz 2024 年 3 月 15 日
@Dorian, the first argument needs to be a figure handle.
function JourButtonPushed(app, event)
exportapp(app.UIFigure,'file.png');
end

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

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by