Here's a minimal example of my problem:
innerFunc([2, 4, 5]) % works fine
outerFunc(innerFunc, [2, 4, 5]) % doesn't work
function out = innerFunc(my_vec)
my_vec % not recogniced when called from outerFunc
out = -1;
end
function out = outerFunc(func, my_vec)
out = func(my_vec);
end
This is the output of the code:
my_vec =
2 4 5
ans =
-1
Not enough input arguments.
Error in nested_funcs_bug>innerFunc (line 5)
my_vec % not recogniced when called from outerFunc
Error in nested_funcs_bug (line 2)
outerFunc(innerFunc, [2, 4, 5]) % doesn't work
>>
I don't know why the eror in line 2?
Especially since "innerFunc" usually works and I pass it an input in the outerFunc function.