How can I generalize this for loop?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
My question is easy. How can I generalize this for loop?
-----------------------
for i=1:r
t(1)=(d(1))/total
t(2)=(d(2)+d(1))/total
t(3)=(d(3)+d(2)+d(1))/total
t(4)=(d(4)+d(3)+d(2)+d(1))/total
.
.
.
end
------------------------
0 comentarios
Respuesta aceptada
Más respuestas (2)
Chandrasekhar
el 12 de Jul. de 2013
sum = 0;
for I = 1:r
sum = sum + d(I);
t(i) = sum/total;
end
0 comentarios
Ver también
Categorías
Más información sobre Logical 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!