Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]()
我想重用我在Matlab脚本中创建的图形。
fig1 = figure; plot(...); title(...); % ... % now I would like to plot fig1 again with a different title % ... % now I would like to plot fig1 again as a subplot in a 2x2 grid 没有代码重复怎么办? 我可以使用图形对象吗?还是以某种方式保存绘图对象? 回答: plot和好友都在当前轴上工作,因此只需将所有代码(不包括figure )放入单独的(子)函数中,然后在设置新的Figure / title / subplot后调用它。 如果由于某种原因您无法执行此操作,请在此处查看页面底部的示例。 更多&回答... |
![]() |
![]() |