Programming Previous page   Next Page

Overloaded Functions

Overloaded functions are useful when you need to create a function that responds to different types of inputs accordingly. For instance, you might want one of your functions to accept both double-precision and integer input, but to handle each type somewhat differently. You can make this difference invisible to the user by creating two separate functions having the same name, and designating one to handle double types and one to handle integers.

See Classes and Objects: An Overview for more information on overloading functions in MATLAB.

Class Directories

MATLAB overloaded functions reside in subdirectories having a name starting with the symbol @ and followed by the name of a recognized MATLAB data type. For example, functions in the \@double directory execute when invoked with arguments of MATLAB type double. Those in an \@int32 directory execute when invoked with arguments of MATLAB type int32.


Previous page  Private Functions Data Import and Export Next page

© 1994-2005 The MathWorks, Inc.