How to prevent overwrite the graph in looping?
7 views (last 30 days)
Show older comments
I want to have three eyediagrams and one graph combine three while loop together. The codes is something like the below:
N=2
while (N<=4)
. . . . . .
eyediagram(........)
if(N==2)
figure;
semilogy(........);
hold on;
semilogy(........);
elseif (N==3)
semilogy(........);
hold on;
semilogy(........);
else
semilogy(........);
hold on;
semilogy(........);
. . . . . . .
N=N+1;
end
3 Comments
Accepted Answer
Birdman
on 8 Mar 2018
Define figure and hold on just once before while loop. It would be more efficient:
N=2;
figure;hold on;
while (N<=4)
. . . . . .
eyediagram(........)
if(N==2)
semilogy(........);
semilogy(........);
elseif (N==3)
semilogy(........);
semilogy(........);
else
semilogy(........);
semilogy(........);
. . . . . . .
N=N+1;
end
8 Comments
Walter Roberson
on 11 Mar 2018
You did not follow the structure I posted! When you follow the structure I posted, it works fine.
More Answers (0)
See Also
Categories
Find more on Sources and Sinks 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!