![]() |
如何在Matlab中重用图形?
我想重用我在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 没有代码重复怎么办? 我可以使用图形对象吗?还是以某种方式保存绘图对象? [B]回答:[/B] plot和好友都在当前轴上工作,因此只需将所有代码(不包括figure )放入单独的(子)函数中,然后在设置新的Figure / title / subplot后调用它。 如果由于某种原因您无法执行此操作,请在[URL="http://www.mathworks.com/help/techdoc/ref/copyobj.html"]此处查看[/URL]页面底部的示例。 [url=https://stackoverflow.com/questions/4417819]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 01:03。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.