I built this small while loop in order to consistently reduce total supply until it is below or equal to total demand. The calculation is relatively simple and should only require the loop to iterate a handful of times (sub 100).
Yet, when I run, the price only reduces by one increment and the counter shoots up infinitely. Can anyone help?
Thanks
Cite As
Jordan Bisset (2025). Issue with While loop (https://se.mathworks.com/matlabcentral/fileexchange/66970-issue-with-while-loop), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2017b
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Loops and Conditional Statements in Help Center and MATLAB Answers
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
