Only saving last run for loop
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Alexander Garber
el 11 de Abr. de 2021
Comentada: Alexander Garber
el 12 de Abr. de 2021
This is my code
for i=1: 560;
z=z+dz;
pie=pie-((g/(cp*thetav(z)))*z);
end
I need pie for later calculations. The problem is that it only saves the last value of pie, and forgets all the rest. Is there a way to fix this?
Thanks
Respuesta aceptada
David Hill
el 11 de Abr. de 2021
pie(1)=0;
for i=1: 560;
z=z+dz;
pie(i+1)=pie(i)-((g/(cp*thetav(z)))*z);
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Pie Charts 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!