Exporting UIFigure using Matlab 2020a
1 回表示 (過去 30 日間)
古いコメントを表示
Hello all,
I have created an app which displays some data upon clicking some buttons. I want to save the UIFigure (with all the data) as a pdf or a jpg file. I know that for Matlab 2020b and onwards, there is the 'exportapp'. However, I am using Matlab 2020a and was wondering what alternatives exist to save the app UI as a pdf or an image. I tried using the following command: exportgraphics('app.UIFigure','screenshot.jpg') but this gives a blank jpg image.
Thank you for your time.
Kind Regards,
Abhishek
0 件のコメント
回答 (1 件)
Satyam
2025 年 4 月 23 日
Hi Abhishek,
I faced a similar issue in MATLAB R2020a but I observed that it was working fine with MATLAB R2020b onwards. So, a possible fix could be to try upgrading MATLAB to a newer version. There is also a workaround which I found, instead of passing 'app.UIFigure', I tried passing a component inside it which in my case was the axes object 'app.UIAxes' and it was working fine with it.
% Button pushed function: Button
function ButtonPushed(app, event)
% Plot some data
plot(app.UIAxes, rand(1,10));
app.Label.Text = 'Data Plotted!';
end
% Button pushed function: SaveImageButton
function SaveImageButtonPushed(app, event)
figure(app.UIFigure);
exportgraphics(app.UIAxes,'screenshot.jpg') %Works Fine
end
Hope it helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!