23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Function Handles<br />

isequal(h1, h2)<br />

ans =<br />

1<br />

Additional Information on Function Handles<br />

This section covers the following topics:<br />

• “Maximum Length of a Function Name” on page 4-31<br />

• “How <strong>MATLAB</strong> Constructs a Function Handle” on page 4-31<br />

• “Saving and Loading Function Handles” on page 4-32<br />

Maximum Length of a Function Name<br />

Function names used in handles are unique up to N characters, where N is<br />

the number returned by the function namelengthmax. If the function name<br />

exceeds that length, <strong>MATLAB</strong> truncates the latter part of the name.<br />

For function handles created for Java constructors, the length of any<br />

segment of the package name or class name must not exceed namelengthmax<br />

characters. (The term segment refers to any portion of the name that lies<br />

before, between, or after a dot. For example, java.lang.String has three<br />

segments). The overall length of the string specifying the package and class<br />

has no limit.<br />

How <strong>MATLAB</strong> Constructs a Function Handle<br />

Atthetimeyoucreateafunctionhandle,<strong>MATLAB</strong>mapsthehandletooneor<br />

more implementations of the function specified in the constructor statement:<br />

fhandle = @functionname<br />

In selecting which function(s) to map to, <strong>MATLAB</strong> considers<br />

• Scope — The function named must be on the <strong>MATLAB</strong> path at the time<br />

the handle is constructed.<br />

• Precedence — <strong>MATLAB</strong> selects which function(s) to map to according to<br />

the function precedence rules described under “How <strong>MATLAB</strong> Determines<br />

Which Method to Call” on page 9-72.<br />

4-31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!