Is there a saveas function for axes/graphs in App Designer?

1 visualización (últimos 30 días)
Laura Treurniet
Laura Treurniet el 24 de Mayo de 2016
Respondida: prabhat kumar sharma el 2 de Abr. de 2024
We are trying to save a graph as jpg in App Designer, is there a function that is able to do this?

Respuestas (1)

prabhat kumar sharma
prabhat kumar sharma el 2 de Abr. de 2024
Hi Laura,
I understand you want to save your graph as a jpg image. I belive saveas function is not supported with figures created using uifigure, which is the type of figure used in MATLAB App Designer.
However, exportgraphics is designed to work with uifigure-based figures, making it the recommended approach for saving graphics from App Designer apps.
Please find the below code for refrence:
% Create some data and plot it
x = linspace(0, 2*pi, 100);
y = sin(x);
fig = figure;
plot(x, y);
% Save the figure to a JPG file using exportgraphics()
filename = 'plot_exportgraphics.jpg';
exportgraphics(gca, filename);
I hope it helps!

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by