How to debug only the N-th call to a function?
Ältere Kommentare anzeigen
I have a script that calls fmincon to minimize a function, call it @myfun. The solver makes it through 3 iterations (each with dozens of function evaluations of @myfun), and then it seems to be forever stuck on the 4th iteration. Every time I use ctrl+c to exit the function terminates during a particular subfunction of @myfun, so I suspect something is going on there (i.e. the subfunction is taking forever to evaluate with a particular input that the solver is giving it). In order to investigate this I could put a breakpoint in the subfunction, but then I would have to press F5 about 1000 times before getting to the point where the problem is. What is the best way to debug something like this (where the breakpoint needs to be inside of a function that is called many times, but you don't want to stop until the N-th evaluation)?
Thanks!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Choose a Solver finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!