I am getting the error "Undefined function or variable", but the function I am calling is defined and on my MATLAB path.
I am calling this function within a conditional block of another function. The conditional block is set up as follows:
function fun1() if myCondition fun2 = aValue else fun2() endend
When I execute "fun1", it goes into the else-block and then errors out on the line which calls "fun2".
I tried setting a breakpoint on this line and running "fun1" again. At this point, if I highlight the line "fun2()" and press F9, or copy and paste this line into my MATLAB command window, it runs successfully without an error. But if I press the buttons 'continue', 'step', or 'step in', I get the error "Undefined function or variable".
Why is this, and how can I make sure MATLAB finds the function which I have defined?
Best Answer