Having trouble with Complicated for loop
Mostrar comentarios más antiguos
I have created this program, but having issues with my loop. My program is suppose to do calculation 24 times within a loop of 5. so intotal i have 120 iterations, and at each iteration the new values become the old values for the following iteration. my problem is that I can't get my 24th value to become my first value of the next loop.
for example my loop looks like this:
To = 20; %initial value
for h = 1:5 % days
for t = 1:24 %hours
MatrixB (1,2) = To* "Values"
X(:,t) = A\B;
Tn = X; % New Temp
To(:,t+1) = Tn(:,t); %new temp becoming old temp for next iteration
end
end
now my issue is trying to get the value on the 24th hour on day 1 to become my initial value of To on hour 1 of day 2 so that I can continue the iteration for another 4 days. so far my values are the same for each day which cannot be.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!