Plotting two .m files on one graph

10 ビュー (過去 30 日間)
Megan Mirkhanian
Megan Mirkhanian 2020 年 1 月 31 日
コメント済み: Rik 2020 年 1 月 31 日
I keep plotting 2 .m files on one graph but they keep plotting on separate graphs. I used hold on on one of the files.
  1 件のコメント
Megan Mirkhanian
Megan Mirkhanian 2020 年 1 月 31 日
File2=csvread('secondhalf.CSV') % samplmean=mean(File2) % std(File2) averageY2 = mean(File2); sigmaY2 = std(File2); x1 = linspace(min(File2),max(File2),50); %this produces a sorted vector over which to plot the pdf norm = normpdf(x1,averageY2,sigmaY2); figure; plot(x1,norm,'-k'); hold on;

サインインしてコメントする。

回答 (1 件)

Bhaskar R
Bhaskar R 2020 年 1 月 31 日
Maintain same figure value in both files. suppose
file_1.m
figure(1) % figure 1
plot(1:100)
hold on
file_2.m
figure(1) % same figure handle
file_1; % calling first file
plot(2*[1:100]);
legend('show')
  1 件のコメント
Rik
Rik 2020 年 1 月 31 日
Or change the m files to functions that accept a figure or axes handle as an input.

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by