for idx = 1 hold on plot(idx,density(idx),"*") hold off pause(0.2) end showing incorrect
Mostrar comentarios más antiguos
Name your loop counter idx. For the first execution of the loop, idx should have a value of 1, and it should increase by 1 each consecutive iteration.
Respuestas (3)
KSSV
el 6 de Jul. de 2022
density = density(:) ;
idx = (1:length(density))' ;
figure
plot(idx,density)
comet(idx,density)
Walter Roberson
el 18 de Sept. de 2022
for idx = 1:MaximumNumberOfIterationsGoesHere
Yogesh
el 22 de Abr. de 2025
density = density(:) ;
idx = (1:length(density))' ;
figure
plot(idx,density)
comet(idx,density
1 comentario
Walter Roberson
el 22 de Abr. de 2025
@Yogesh What difference is there between this answer and the one @KSSV posted nearly three years ago, https://www.mathworks.com/matlabcentral/answers/1754580-for-idx-1-hold-on-plot-idx-density-idx-hold-off-pause-0-2-end-showing-incorrect#answer_1001425
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!