Clear Filters
Clear Filters

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

2 views (last 30 days)
We are trying to save a graph as jpg in App Designer, is there a function that is able to do this?

Answers (1)

prabhat kumar sharma
prabhat kumar sharma on 2 Apr 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!

Categories

Find more on Printing and Saving in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!