Plot not shown in for loop
Afficher commentaires plus anciens
The plot is not appearing for this simple loop
for i=0:0.01:1
if i<0.5
M=1
elseif i<0.7
M=0.5
else
M=0
end
plot(i,M,'LineWidth',2)
hold on
end
Réponse acceptée
Plus de réponses (1)
Jan
le 8 Mar 2022
Exactly. Give Matlab a chance to update the output by inserting the command:
drawnow
inside the loop.
1 commentaire
Mahmoud Abbas
le 8 Mar 2022
Catégories
En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!