figure doesn't appear in new window
11 次查看(过去 30 天)
显示 更早的评论
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
2020-2-10
编辑:Ajay Kumar
2020-2-10
I am getting in 2 different figures. I am using R2019A. Yours?
回答(2 个)
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 个评论
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 :)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!