matlab get stop executing while loop for no reason
Show older comments
Hello everyone:
I am facing a strange problem with Matlab. I have a while loop that should execute optimization function "fminmax". The problem is that suddenly the program stop working it is like it froze. It does not finish the execution, it does not end it also, nothing..as shown in figure bellow.

Does anyone here have an idea why this happen????
Thank you in advance.
9 Comments
Weird Rando
on 4 May 2016
Edited: Weird Rando
on 4 May 2016
You're just stuck in an infinite loop. Chance are that the variable may not be meeting the condition you set for the while loop.
meriame
on 4 May 2016
Jan
on 4 May 2016
The screenshot does not contain any useful information. Please restart Matlab and/or the computer to check, if the problem is reproducible. If so, post the relevant part of the code. Perhaps you only requested a rand(1e6) and the computer stalls while trying to reserve a 10 TByte array.
CS Researcher
on 4 May 2016
Print your maxfval and see if it ever gets smaller than the epsilon. If not, increase the epsilon.
meriame
on 4 May 2016
CS Researcher
on 4 May 2016
What is the error message? Have you initialized j somewhere in the code? Also, there should be a ';' between maxfval=abs(maxfval) and j=j+1
meriame
on 4 May 2016
CS Researcher
on 4 May 2016
Well then it seems that maxfval becomes smaller than epsilon in the first run. Try changing epsilon. It would be easier for me to understand if you can share the entire code.
Answers (0)
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!