storing values from loops
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
harley
am 3 Okt. 2013
Beantwortet: David Sanchez
am 3 Okt. 2013
how do i store the values of MJ_V12, they are being overwritten in each loop. Should end up with a 41 x 100 matrix. i've tried
MJ_V12=zeros(41,100);
but didn't work for me.
for a=[1:100];
%coding here left out
FMJ_cars_wait_2 = @(T12,MJ_V12) (lambdaMJ_sec(a) - MJ_Flow);%
[T12,MJ_V12] = ode45(FMJ_cars_wait_2,[MJ_Red,Total_cycle],R_G_MJ);
end
0 Kommentare
Akzeptierte Antwort
David Sanchez
am 3 Okt. 2013
Use a temporary variable:
for a=[1:100];
%coding here left out
FMJ_cars_wait_2 = @(T12,MJ_V12) (lambdaMJ_sec(a) - MJ_Flow);%
[T12,temp_var] = ode45(FMJ_cars_wait_2,[MJ_Red,Total_cycle],R_G_MJ);
MJ_V12(:,a) = temp_var;
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!