D(y)
function B(x,y) % Nested in A
C(x)
D(y)
function C(x) % Nested in B
D(x)
end
end
function D(x) % Nested in A
E(x)
function E(x) % Nested in D
disp(x)
end
end
end
The easiest way to extend the scope of a nested function is to create a function handle
and return it as an output argument, as shown in “Using Handles to Store Function
Parameters” on page 20-34. Only functions that can call a nested function can create a
handle to it.
See Also
More About
- “Variables in Nested and Anonymous Functions” on page 20-39
- “Create Function Handle” on page 13-2
- “Argument Checking in Nested Functions” on page 21-11
20 Function Basics