Storing the values of a for loop

2 visualizaciones (últimos 30 días)
Aishwarya Bangalore Kumar
Aishwarya Bangalore Kumar el 12 de Feb. de 2018
Comentada: Star Strider el 12 de Feb. de 2018
That is the line to increment ze from 0.1 to 1.2 in increments of 0.1. How do I store the values of ze?
for ze=0.1:0.1:1.2 end;
  3 comentarios
Aishwarya Bangalore Kumar
Aishwarya Bangalore Kumar el 12 de Feb. de 2018
can you elaborate a little?
Stephen23
Stephen23 el 12 de Feb. de 2018
@Aishwarya Bangalore Kumar: it creates a vector ze with values from 0.1 to 1.2 in steps of 0.1.

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 12 de Feb. de 2018
Assign ‘ze’ before the loop, then index with reference to it:
ze = 0.1:0.1:1.2;
for k = 1:numel(ze)
v(k) = % DO SOMETHING
end
  8 comentarios
Aishwarya Bangalore Kumar
Aishwarya Bangalore Kumar el 12 de Feb. de 2018
Thank you I understood now , it was a big help!
Star Strider
Star Strider el 12 de Feb. de 2018
As always, my pleasure!

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by