How can I save UIAxes as an image when button is pushed in app designer?
32 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
How can I save UIAxes as an image when button is pushed in app designer?
newfigure = figure;
copyobj(app.UIAxes, newfigure);
hgsave(newfigure, 'testFIgure.fig');
I tried this but it gives me an error.
3 comentarios
Respuestas (2)
Image Analyst
el 3 de Jul. de 2020
Try exportgraphics().
Adam Danz
el 24 de Sept. de 2020
The code you shared shows that you're exporting the children of a UIAxes onto a regular axis.
That can be done with copyUIAxes() from the file exchange, even on Matlab releases prior to 2020. That function avoids the problem of disappearing axis labels.
2 comentarios
zsh fardi
el 5 de En. de 2022
Editada: Image Analyst
el 5 de En. de 2022
Hi. Why is copyUIAxes() undefined in Matlab R2021a?
Image Analyst
el 5 de En. de 2022
Editada: Image Analyst
el 5 de En. de 2022
@zsh fardi Because it's a third party function written by Adam. It's not part of base MATLAB. You have to download it, and if it's not in your current folder, use the "Set Path" button on the Home tab of the tool ribbon to add its folder to the path.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!