figureの複製方法について
11 views (last 30 days)
Show older comments
例えば,図1にsin(x)をプロットして,図2にsin(x)とcos(x)をプロットしたい場合,
f1 = figure;
plot(x,sin(x));
f2 = figure;
plot(x,sin(x));
plot(x,cos(x));
のようにするのではなく,
f1を作成してsin(x)をプロットした後に,新しくfigureウインドウをつくりそこにf1にプロットされたものを貼り付けてからcos(x)を上書きする
といったことは可能でしょうか.
何か方法があれば教えてください.
0 Comments
Accepted Answer
Akira Agata
on 4 Dec 2019
copyobj関数が使えるかと思います。
以下は簡単なサンプルコードです。
x = linspace(0,4*pi);
figure
plot(x,sin(x))
ax = gca;
hFig = figure;
copyobj(ax,hFig) % Copy plot(s) in the previous figure
hold on
plot(x,cos(x))
More Answers (1)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!