필터 지우기
필터 지우기

Why is MATLAB not making multiple plots when I specify separate figures?

조회 수: 122 (최근 30일)
Guy
Guy 2023년 3월 10일
답변: Image Analyst 2023년 3월 10일
Hello, I am attemping to plot two separate sets of data on two different figure windows. I used the following code:
figure(1);
plot(theta, p);
figure(2);
plot(theta, T);
But only figure 1 is showing up. I have looked through this forum and I haven't seen any solutions, so some help would be greatly appreciated.

답변 (2개)

Voss
Voss 2023년 3월 10일
편집: Voss 2023년 3월 10일
figure(2)
makes Figure 2 the current figure, if it exists, or creates a new figure called Figure 2 if it does not already exist and makes it the current figure.
It may be that Figure 2 already exists and its Position is outside the range of your monitor(s) or it's very small and you don't notice it.
Regardless, if you want to create a new figure, use
figure()
So this
figure();
plot(theta, p);
figure();
plot(theta, T);
would create two new figures, each with the their own plot(s).
  댓글 수: 1
Guy
Guy 2023년 3월 10일
Great, it's working now. I think I just needed to restart MATLAB. Thank you for your help though.

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


Image Analyst
Image Analyst 2023년 3월 10일
You could put
close all
at the beginning of your script to close all windows. It should work then, though I'm not sure why it didn't work in the first place.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by