counting and plotting elements in a vector
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
hi there, i want to count the number of elements in a vector and plot it right away. ex: v = [2,3,2,4,5,6,5,6,7,] the out put should be plotted right away. so the a plot should be made whos x-axis extends from 1 - 10 (y depends on counts so doesnt matter) so for the first plot, since there are no 1s...no count(or 0) is plotted then that plot is held and the count of 2 is plotted so it will be one, then next is 3 - one again, next is 2 in the vector but now we have gone up to count two so two is plotted and so on. so basically i want to plot the counts as the loop is run through the vector and the plot is updated with each loop. any help would be appreciated. thanks
0 comentarios
Respuestas (1)
Image Analyst
el 7 de Oct. de 2013
for k = 1 : length(v)
plot(k, v(1:k), 'bo-');
drawnow;
pause(0.5);
end
Ver también
Categorías
Más información sobre Graphics Objects en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!