How can plot every n-th element in a vector AND the last element?
Mostrar comentarios más antiguos
Hello everyone,
i want to plot just every n-th vector element in a for-loop, to speed up the plot loading time.
But I need also the last element to be plotted.
For example:
%p = [1,2,3,...,100,102,102]
n = 10
for i=10:n:102
k(i) = p(i)
...
end
The vector should than look like this: [10,20,30,40,50,60,70,80,90,100,102].
Also it would be great if i could avoid the error because of index exceeding the array bounds.
Thank you in advance!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Mathematics 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!