Skip for loop iteration if it takes too long to run

2 次查看(过去 30 天)
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?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by