Imported Functions
After the variable names, when a locally defined function matches the name of an explicitly imported function, MATLAB will always use the imported function for the given name.
In the following example, we create a dummy function of the name numericalJacobian. And then import the following function
Matlab
import curvefit.numericalJacobian |
Now, when we call the same function in the command window, instead of calling the local function, MATLAB will use the imported one.
Output:
As it can be seen in the error message, the used function is curvefit.numericalJacobian and not the local numericalJacobian.
Function Precedence Order in MATLAB
In this article, we shall discuss the function precedence order in MATLAB. The first thing to keep in mind is that the order explained below is defined for an individual scope (current workspace); it does not hold when there are multiple workspaces in play.
Now, let us explore the order individually.