Borrar filtros
Borrar filtros

could anyone help me to solve the issue for the following code.

2 visualizaciones (últimos 30 días)
jaah navi
jaah navi el 16 de Abr. de 2019
Comentada: Stephen23 el 16 de Abr. de 2019
code:
i=1:3
for j=1:length(i)
j=j+1
end
the code excutes and give the output j = 2
j = 3
j = 4
could anyone help how to add all the values (j=2+3+4)after for loop.

Respuestas (1)

KSSV
KSSV el 16 de Abr. de 2019
Editada: KSSV el 16 de Abr. de 2019
Why you want to use a loop?
i = 1:3 ;
iwant = sum(i+1)
  2 comentarios
jaah navi
jaah navi el 16 de Abr. de 2019
that is just the sample,I just gave with an example.
In my code i need to add up all the values generated by using formula after for loop each time.
Torsten
Torsten el 16 de Abr. de 2019
i=1:3;
jj=0;
for j=1:length(i)
j=j+1;
jj=jj+j;
end
jj

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