missing axes after copy

I have a UIAxes in an app that I want to save as a .fig file so I'm using this:
placeholder=figure();
placeax=copyobj(app.UIAxes,placeholder,"legacy");
savefig(placeax,[app.folder,'\Results\',app.model,' - nodeview.fig']);
The new figure is created and the graph is copied across but I can't see it. What I mean by that is when hovering my mouse over I can see that the axes and the points are there but the graphic doesn't show up.
Any suggestions as to why I can't see the graph?

4 件のコメント

dpb
dpb 25分 前
The target is an "ordinary" figure into which you're placing a new UIAxes. Try into a UIFigure instead
Timothy
Timothy 約7時間 前
I have the same issue that I can't save a UIfigure as a .fig file - at least not using savefig. Also it doesn't seem to slove the issue anyway
Stephen23
Stephen23 約7時間 前
編集済み: Stephen23 約7時間 前
uifigure uses the newer web-based UI framework (used by App Designer). Its components (uilabel, uibutton, etc.) are not standard graphics objects and cannot be serialized with savefig.
The .mlapp file is effectively the “save format” (UI + logic together).
dpb
dpb 約6時間 前
Try something on the order of
placeholder=figure('Visible','off');
placeax=copyobj(app.UIAxes.Children,axes(placeholder),'legacy');
savefig(placeholder,fullfile(app.folder,'\Results\',app.model,' - nodeview.fig'));
delete(placeholder); % optional
Nota bene: Untested...
For figures in app developer apps which reside in UIFigure-land, look at exportgraphics

サインインしてコメントする。

回答 (1 件)

dpb
dpb 約6時間 前

1 投票

Try <copyUIAxes> by @Adam Danz (from before he moved to TMW) in FEX

カテゴリ

ヘルプ センター および File ExchangePrinting and Saving についてさらに検索

製品

リリース

R2025b

質問済み:

2026 年 6 月 4 日 13:50

回答済み:

dpb
2026 年 6 月 4 日 16:30

Community Treasure Hunt

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

Start Hunting!

Translated by