Setting a counter to save values in a for loop

3 visualizaciones (últimos 30 días)
Om
Om el 22 de Feb. de 2016
Editada: Stephen23 el 22 de Feb. de 2016
Hi all I have a for loop running 1:100:10,
It is calculating a mean on a graph using:
data_meanD1=mean(r(ix,:))
data_meanD2=mean(r(~ix,:))
This is giving me only the average value of one of the means in my workspace.
I wanted to set up a counter to save all 10 mean values outputted on the 10 graphs I am getting, any tips please?
  1 comentario
Stephen23
Stephen23 el 22 de Feb. de 2016
Editada: Stephen23 el 22 de Feb. de 2016
Perhaps you need to review your loop variable, which you specify as 1:100:10. In MATLAB this means "start from one, steps of one hundred until end at ten". This returns just one value! Check out the difference:
>> 1:100:10
ans = 1
>> 1:10:100
ans =
1 11 21 31 41 51 61 71 81 91
Please show us your complete code.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements 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!

Translated by