Is it possible to plot data from multiple scripts on to a single figure?

조회 수: 18 (최근 30일)
Muhammad Waleed
Muhammad Waleed 2022년 10월 23일
편집: Atsushi Ueno 2022년 10월 23일
Hi everyone, I'm a relatively new MATLAB user. I was wondering if it was possible to plot data from three scripts on to a single figure. It's for a numerical methods problem, where the same problem with the same domain is being solved using 3 different numerical schemes. I've written three different scripts and each produces a plot. I was wondering if I could display all 3 on a single graph.

답변 (1개)

Atsushi Ueno
Atsushi Ueno 2022년 10월 23일
편집: Atsushi Ueno 2022년 10월 23일
You can save the figure into a .fig file by using savefig function.
You can also retains plots in the current axes by "hold on" command.
% script file 1
x = 1:0.01:pi*2;
plot(x, sin(x));
savefig('myfig.fig'); % save current figure into a .fig file
% script file 2
openfig('myfig.fig'); % load the .fig file
hold on
x = 1:0.01:pi*2;
plot(x, cos(x));
  댓글 수: 3
Muhammad Waleed
Muhammad Waleed 2022년 10월 23일
Thank you! This seems like it might solve my problem, thanks alot!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by