plot two figures in two different windows

I have this code and I wanted to plot two different figures in different windows, but in my script it gave them in one windows. I tried figure hold on but didn't work.
count = fopen(ppath, 'r');
for ra=1:5
s = fgets(cout);
end
ii = 1;
while ischar(s)
s = fgets(cout);
if(ischar(s))
result = sscanf(s, '%f');
if choc==1
x(ii) = result(3);
y(ii) = result(15);
z(ii)= result(20);
ii = ii + 1;
else
x(i) = data(3);
y(i) = data(15);
z(i)= data(20);
ii = ii + 1;
end
end
end
if choc==1
plot(x,y);
plot (x,z);
else
plot(x,y);
plot (x,z);
end end

답변 (1개)

Matt J
Matt J 2018년 2월 2일
편집: Matt J 2018년 2월 2일

1 개 추천

Modify as follows,
figure(1); plot(x,y);
figure(2); plot (x,z);

댓글 수: 11

Najiya Omar
Najiya Omar 2018년 2월 2일
didn't work, figure 2 gave windows without plot
Matt J
Matt J 2018년 2월 2일
You'll need to provide code that we can run, to reproduce the problem.
Najiya Omar
Najiya Omar 2018년 2월 2일
this whole code just the beginning is ppath = sprintf('......");
Matt J
Matt J 2018년 2월 2일
Where does "choc" come from?
choc indicates two possibilities of two folders to read either 1 or 2
if( choc == 1)
ppath = sprint('.........
else
ppath=sprint ('........
end
Matt J
Matt J 2018년 2월 2일
편집: Matt J 2018년 2월 2일
I don't want to guess what you are actually running. Please provide complete, self-contained code for us to run and which you've tested, and which reproduces your problem.
Matt J
Matt J 2018년 2월 2일
편집: Matt J 2018년 2월 2일
Your code does not run because the line
ppath = sprint('.........
is incomplete.
Error: File: test.m Line: 8 Column: 30
Character vector is not terminated properly.
Najiya Omar
Najiya Omar 2018년 2월 2일
This is my folder has files that contain data matrixes.
Matt J
Matt J 2018년 2월 2일
I repeat my request. Please provide stand-alone code, tested by you to ensure that we can run it without errors, which when run demonstrates the undesired result.
Najiya Omar
Najiya Omar 2018년 2월 2일
It worked with me, but the issue in the figures, one it plotted perfectly and the another didn't show.
Matt J
Matt J 2018년 2월 2일
I have no way to investigate that, without code that reproduces it.

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

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

2018년 2월 2일

댓글:

2018년 2월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by