I want to run a loop until a value is reached and, then, I want to use that reached value to continue the loop
51 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everyone! Thanks for helping.
I'm running a code about hydrogeology. I'm calculating tha saturated portion of a soil depending on rainfall amount.
I need Matlab to calculate this saturated thickness until a certain value H is reached. This value is the maximum depth of the soil of course.
When the loop reaches H, I want Matlab to keep on doing the calculations assuming H as the new starting point, instead of the value > H that it has been encountered.
How can I do this? Thanks for helping!
0 Kommentare
Akzeptierte Antwort
Voss
am 13 Apr. 2022
Hard to say for sure, but maybe some structure like this (but with a break condition - which was unspecified in the question):
H = 100;
thickness = 0;
while true
thickness = thickness+1;
if thickness >= H
thickness = thickness-H;
end
end
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Biological and Health Sciences 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!