MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
Nested Functions ............................... 20-32
What Are Nested Functions? ................... 20-32
Requirements for Nested Functions .............. 20-32
Sharing Variables Between Parent and Nested Functions
....................................... 20-33
Using Handles to Store Function Parameters ....... 20-34
Visibility of Nested Functions................... 20-37

Variables in Nested and Anonymous Functions ...... 20-39

Private Functions............................... 20-41

Function Precedence Order...................... 20-43

Function Arguments


21


Find Number of Function Arguments............... 21-2

Support Variable Number of Inputs................. 21-4

Support Variable Number of Outputs............... 21-6

Validate Number of Function Arguments............ 21-8

Argument Checking in Nested Functions ........... 21-11

Ignore Function Inputs .......................... 21-13

Check Function Inputs with validateattributes ...... 21-14

Parse Function Inputs........................... 21-17

Input Parser Validation Functions................. 21-21

xxii Contents

Free download pdf