How can I save UIAxes as an image when button is pushed in app designer?
조회 수: 47 (최근 30일)
이전 댓글 표시
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.
답변 (2개)
Adam Danz
2020년 9월 24일
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
zsh fardi
2022년 1월 5일
편집: Image Analyst
2022년 1월 5일
Hi. Why is copyUIAxes() undefined in Matlab R2021a?
Image Analyst
2022년 1월 5일
편집: Image Analyst
2022년 1월 5일
@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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Printing and Saving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!