Resolve Error: Undefined Function or Variable
you cannot, you need to install it in order to use it. For help with installing MathWorks products, see
“Installation and Licensing”.
Verify Path Used to Access Function Toolbox
Tip If you have a custom file path, this step will delete it.
The MATLAB search path is a subset of all the folders in the file system. MATLAB uses the search
path to locate files used with MathWorks products efficiently. For more information, see “What Is the
MATLAB Search Path?”.
If the function you are attempting to use is part of a toolbox, then verify that the toolbox is available
using ver.
Because MATLAB stores the toolbox information in a cache file, you need to first update this cache
and then reset the path.
1
On the Home tab, in the Environment section, click Preferences.
The Preference dialog box appears.
2 On the MATLAB > General page, select Update Toolbox Path Cache.
3
On the Home tab, in the Environment section, select Set Path.
The Set Path dialog box opens.
4 Select Default.
A small dialog box opens warning that you will lose your current path settings if you proceed.
Select Yes if you decide to proceed.
Run ver to see if the toolbox is installed. If not, you may need to reinstall this toolbox to use this
function. For more information about installing a toolbox, see How do I install additional toolboxes
into an existing installation of MATLAB.
Once ver shows your toolbox, run the following command to see if you can find the function:
which -all <functionname>
replacing <functionname> with the name of the function. If MATLAB finds your function file, it
presents you with the path to it. You can add that file to the path using the addpath function. If it
does not, make sure the necessary toolbox is installed, and that it is the correct version.
Confirm The License Is Active
If you are unable to use a built-in function from a MATLAB toolbox and have confirmed that the
toolbox is installed, make sure that you have an active license for that toolbox. Use license to
display currently active licenses. For additional support for managing licenses, see “Manage Your
Licenses”.
1-11