如何将相应情节的传说以及本身复制到另一个情节中?

发布于 2025-02-13 02:33:35 字数 328 浏览 1 评论 0原文

我正在处理以下代码,将保存的图将其复制到另一个代码中。

fig1 = openfig('ABC.fig');
fig2 = openfig('DEF.fig', 'invisible');
copyobj(fig2.Children.Children, fig1.Children);

只要我不使用fig2中的传说,我就会有效,然后我会获得一个错误消息,用于在copybj中使用过多的输入参数。在文档中,我了解到copyObj没有复制传奇的上下文菜单,因此我也要求您在复制传说时提供帮助。

I'm working with the following Code to copy a saved plot into another.

fig1 = openfig('ABC.fig');
fig2 = openfig('DEF.fig', 'invisible');
copyobj(fig2.Children.Children, fig1.Children);

This works fine, as long as I'm not using a legend in fig2, then I get a Error message for using too many input arguments in copyobj. In the documentation I learnt, that copyobj doesn't copy the context menu of legends, so I'm asking for your help in copying the legend as well.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

失眠症患者 2025-02-20 02:33:35

如图所示在这里

plot(rand(2))
l = legend('show'); % legend
ax = gca; % associated axes

fnew = figure;
copyobj([l,ax],fnew) 
% This is what the error was telling you. 
% You need to pass your axes object 
% along with you legend object as an array of graphic objects

[l,ax]

ans =

1×2图形数组:

 图形图形
 

As shown here:

plot(rand(2))
l = legend('show'); % legend
ax = gca; % associated axes

fnew = figure;
copyobj([l,ax],fnew) 
% This is what the error was telling you. 
% You need to pass your axes object 
% along with you legend object as an array of graphic objects

[l,ax]

ans =

1×2 graphics array:

Graphics    Graphics
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文