My Matlab code looks something like this:
for t = 1:T
arg = (do some calculation)
func(arg)
end
I know that there is something wrong with the calculation in the loop that causes an error inside the body of func. But if I set the debugger to stop on an error, it will stop inside the body of func. What I really need is to step outside of func and into the for loop to see what calculation went wrong. T is a huge number so manually stepping through is not an option. I also cannot pass t to func because the entire piece of code is read-only. Is there a way for the debugger to step out from func when an error occurs?

