How to save for loop values?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Qasim Mohammed
el 28 de Feb. de 2020
Comentada: Star Strider
el 28 de Feb. de 2020
f=zeros(1,M);
for i=1:M
f(i)=fd+((1+m(i)*r)/2)*f_delta;
f(i)=fd-((1+m(i)*r)/2)*f_delta;
end
I need to save both values for the addition and subtraction.
Thanks in advance.
0 comentarios
Respuesta aceptada
Star Strider
el 28 de Feb. de 2020
Try this:
f=zeros(2,M);
for i=1:M
f(:,i)=[fd+((1+m(i)*r)/2)*f_delta; fd-((1+m(i)*r)/2)*f_delta];
end
That saves them as different rows of a (2xM) matrix.
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Startup and Shutdown 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!