figureの複製方法について
조회 수: 36 (최근 30일)
이전 댓글 표시
例えば,図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
채택된 답변
Akira Agata
2019년 12월 4일
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))
추가 답변 (1개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!