MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Visibility of Nested Functions


Every function has a certain scope, that is, a set of other functions to which it is visible. A
nested function is available:



  • From the level immediately above it. (In the following code, function A can call B or D,
    but not C or E.)

  • From a function nested at the same level within the same parent function. (Function B
    can call D, and D can call B.)

  • From a function at any lower level. (Function C can call B or D, but not E.)


function A(x, y) % Main function
B(x,y)

Nested Functions
Free download pdf