figure doesn't appear in new window

조회 수: 12 (최근 30일)
Deepa Maheshvare
Deepa Maheshvare 2020년 2월 10일
댓글: Ajay Kumar 2020년 2월 10일
I'm trying to plot two figures
for p = 1:2
figure(1)
subplot(1,2,p)
plt = plot(1:10,rand(10,1),'LineWidth', 1.5);
p =p+1;
end
for p = 1:2
figure(2)
subplot(1,2,p)
plt = plot(1:10,rand(10,1),'LineWidth', 1.5);
p =p+1;
end
For some reason, the second figure doesn't appear in a new figure window. figure(2) is overwritten on figure(1).
Any suggestions on how to fix this problem?
Thanks
  댓글 수: 1
Ajay Kumar
Ajay Kumar 2020년 2월 10일
편집: Ajay Kumar 2020년 2월 10일
I am getting in 2 different figures. I am using R2019A. Yours?

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

답변 (2개)

Ajay Kumar
Ajay Kumar 2020년 2월 10일
편집: Ajay Kumar 2020년 2월 10일
Are you sure? because Figure 2 window lies exactly on Figure 1 window. Just check the matlab windows.
If you want to shift the focus to figure1 :
drawnow;
figure(1)
Add these 2 lines at the end of code.
  댓글 수: 2
Deepa Maheshvare
Deepa Maheshvare 2020년 2월 10일
It turns out when I change figure(1) and figure(2) to figure(2) and figure(3)
I see both plots. the problem is with figure(1) window. This is strange
Ajay Kumar
Ajay Kumar 2020년 2월 10일
Haha. It is. try close all at the start of code with fig 1 and 2. you may have some luck :)

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


Deepa Maheshvare
Deepa Maheshvare 2020년 2월 10일
I'm using 2019b. I see only Figure2

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by