I'm using fminsearch to find the optimal solution of a problem and for some reason that is not related to the issue, I'm doing it by parts, calling fminsearch repeatedly. So, I have access to the value of the function (fval) everytime I call it (the program prints fval). The thing is that sometimes I see how fval increases and diverges from the optimum and in that cases I want to make and input and tell the program to go to the next case (break).
I can't include and if that states if fval is increasing go to the next case, because sometimes it increase and ends converging to the optimal solution. And I can't put and input that ask if I want to continue in every iteration, the process would be to long and I would have to be in front of the computer all day
Ideas? Thanks