How to save app.UITable as image (.png for example)
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dominique
am 28 Feb. 2023
Kommentiert: Dominique
am 28 Mär. 2023
I have a GUI with App Designer to populate a UITable object.
A button press will populate the table. The output is for example as in screenshot below:
I need to save this output as .png
Is there a way to a achieve this?
Thanks.
0 Kommentare
Akzeptierte Antwort
DUY Nguyen
am 2 Mär. 2023
Bearbeitet: DUY Nguyen
am 2 Mär. 2023
Hi Dominique,
You can take a screenshot of the figure using the getframe function. Then, you can save the screenshot as a PNG file using the imwrite function. The below code worked!
You may modify the code and put it in the click_button_function. If you have the table on the UIaxes, you may need to copy the contents of the UIAxes object to the new figure: copyobj(axes, fig);
% Get the figure handle
fig = uifigure('Name', 'Table Figure');
t = uitable(fig, 'Data', magic(5));
% Take a screenshot of the figure
screenshot = getframe(fig);
% Save the screenshot as a PNG file
imwrite(screenshot.cdata, 'table.png', 'png');
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!