plot two figures in two different windows
Show older comments
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
Answers (1)
Modify as follows,
figure(1); plot(x,y);
figure(2); plot (x,z);
11 Comments
Najiya Omar
on 2 Feb 2018
Matt J
on 2 Feb 2018
You'll need to provide code that we can run, to reproduce the problem.
Najiya Omar
on 2 Feb 2018
Matt J
on 2 Feb 2018
Where does "choc" come from?
Najiya Omar
on 2 Feb 2018
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
on 2 Feb 2018
Matt J
on 2 Feb 2018
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
on 2 Feb 2018
Matt J
on 2 Feb 2018
I have no way to investigate that, without code that reproduces it.
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!