What is the calling priority for MATLAB functions?

If I call a MATLAB function at the command line or in a function, I would like to know what type of object or function will be referenced.

 Accepted Answer

The following is the calling priority for functions and variables in MATLAB 7.0.1 (R14SP1) and MATLAB 7.0 (R14). For items 3 through 7 in this list, the file MATLAB searches for can be any of five types: a MATLAB or built-in (.bi) file, preparsed MATLAB code (P-Code), compiled C or Fortran file (MEX-file), or Simulink® model (MDL-file)
High Priority
Variable
Subfunction
Private function
Class constructor
Overloaded method
Function in the current directory
Function elsewhere in the path
Low Priority
The following is the calling priority for functions and variables in previous releases of MATLAB.
High Priority
Variable
Built-in function
Subfunction
Private function
Mex-file
P-file
MATLAB file
Low Priority
Note, however, that constructors will always be called before non-constructors of the same name. If this weren't true, you wouldn't be able to create the object associated with that constructor.

More Answers (0)

Categories

Find more on Construct and Work with Object Arrays in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!