Using "hold on" to plot from another file

조회 수: 12 (최근 30일)
Lucas Neves
Lucas Neves 2016년 12월 27일
편집: KSSV 2016년 12월 27일
Hello guys!! Here's the problem: I want to plot two graphs at the same figure (both has the same x and y labels) but my second graph, which i saved as a fig, it's from another matlab file... So i'm not getting how can i plot the two graphs in one figure.. So far i tried, and not succeed, doing this:
figure
plot(x,y,'LineWidth',1);
title('Graph1','FontSize',12);
ylabel('X','FontSize',12);
xlabel('Y','FontSize',12);
set(gca,'Ylim',[20 102]);
savefig('Figure1.fig');
hold on;
plot(openfig('Figure2')); %from another matlab file
What am i doing wrong? Thanks and happy hollidays!!!

답변 (1개)

KSSV
KSSV 2016년 12월 27일
편집: KSSV 2016년 12월 27일
You open Figure2 first use hold on, and as you have data for figure1 i.e x,y you plot it.
Or, open the figure you want, get the data from the figure and plot it. You can get the data from the figure as shown in the link:

카테고리

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