Skip for loop iteration if it takes too long to run

1 view (last 30 days)
Hi,
I have a for loop and within that loop I have a numerical optimisation function which converges 99% of the time but in some iterations, it does not and that iteration keeps running with no termination. I want to skip an iteration which takes too long to run. For eg, move to the next iteration if the if the current iteration has already been running for 5 mins but has not yet terminated. I thought of using tic toc but that requires the numerical optimisation function to terminate in order to get the time elapsed. Any ideas as to I can solve this?

Answers (0)

Categories

Find more on Loops and Conditional Statements 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!