App designer : Saveas save all the interface and not just the figure mentionned

2 vues (au cours des 30 derniers jours)
Bastien Binz
Bastien Binz le 1 Juil 2021
Réponse apportée : Saurabh le 16 Fév 2024
Hello,
I made an interface with add designer where I display different graphs. I would like to save these graphs separately.
So I used saveas(app.Power_loss,fullfile(fname,'Simulation of PEMFC'),'fig'); where app.Power_loss is the name of UIAxes.
The first problem is that I can't use the png format but only the fig format.
The second is that it saves the entire interface. Moreover, it only takes into account the graphs comprising a single curve. I can't understand why the saveas command behaves like this. Do you have an idea?

Réponses (1)

Saurabh
Saurabh le 16 Fév 2024
Hi Bastien,
So, what I have understood from your question is that you want to save the graphs of your app separately, and you are using saveas function to achieve this, but the results you got are not what you were looking for.
I have tried to reproduce the issue on my side, and I too faced a similar issue.
So, I did some research on what the possible workaround for this issue could be and found out that there is another function named exportgraphics that can do the required thing.
The syntax for using this function is:
exportgraphics(app.Uifigurename, filename.png);
You need to replace the Uifigurename with the figure you want to save, and filename is the name of the file you want to give.
For more information about this function, you can refer to: https://www.mathworks.com/help/matlab/creating_plots/saving-your-work.html
I hope this was helpful!
Regards,
Saurabh Singh

Catégories

En savoir plus sur Printing and Saving dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by