Making graph at the every for loop

2 views (last 30 days)
Najam us Saqib Fraz
Najam us Saqib Fraz on 20 Oct 2020
Answered: Star Strider on 20 Oct 2020
I have a for loop,which runs for 14 times.After the end of each loop it produces a plot,which means that whole program produces 14 plots.I don't want 14 plot,but each line on single graph.A one plot that have 14 lines at it.

Answers (1)

Star Strider
Star Strider on 20 Oct 2020
First, if you are defining each plot in a separate figure, remove the figure call in the loop and put it before the loop.
Just after the figure call before the loop, use the hold function:
hold on
for ...
hold off
or something similar.
That should do what you want.


Community Treasure Hunt

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

Start Hunting!

Translated by