Exporting UIFigure using Matlab 2020a
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Satyam
le 23 Avr 2025
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 commentaires
Voir également
Catégories
En savoir plus sur Environment and Settings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!