MATLAB: Can’t I open/find example files that are part of a Support Package

Embedded Coderexamplesfoundinstalledpackagesupport

I am trying to open an example model listed in the documentation for a particular toolbox; the page says the example belongs to a Support Package (or a Hardware Support Package), but when I click the shortcut to open the attached files in MATLAB the files are not recognized, and I get an error indicating the system or file was not found.
How can I resolve this?

Best Answer

Usually this happens when the example files are not installed on not currently located on the MATLAB search path. There are several possible explanations.
1. Check which support packages are currently installed on your machine. For instance, if the support package is properly installed you will see the following:
>> matlabshared.supportpkg.getInstalled
Name Version Base Product
-----------------------------------------------------------------------
<Support Package Name> XX.Y.Z <Base Product Name>
2. Check the location of the Support Package Root Directory using the following commands:
>> matlabshared.supportpkg.getSupportPackageRoot
This should return a location similar to the following:
'C:\ProgramData\MATLAB\SupportPackages\RXXXXy'.
Typically, example files are located somewhere off this directory. They may be located in a sub-directory tied to a particular toolbox or set of examples, such as:
C:\ProgramData\MATLAB\SupportPackages\RXXXXy\toolbox\<Toolbox Name>\supportpackages\<Support Package Name>\<examples>’
The "examples" directory typically contains code and/or model files needed to run the examples included with the support package.
Please navigate to the equivalent location on your machine and confirm that the files are located there.
3. If the files do not appear there, please follow the instructions in the following article to re-install the Support Package.
4. Once you have confirmed that the files do exist in that directory, use the 'which' command to identify if the files exist on the MATLAB Path.
>> which example_filename.m
For example, this should return a path location similar to what is shown below:
C:\ProgramData\MATLAB\SupportPackages\RXXXXy\toolbox\<Toolbox Name>\supportpackages\<Support Package Name>\<examples>\example_filename.m’
If ‘which’ returns a valid result, the files are on the MATLAB path and you should be able to open and run them successfully.
If not, please add the files to the MATLAB search path; you may need to use the following command to refresh the path before trying to open the files again:
>> addpath(C:\ProgramData\MATLAB\SupportPackages\RXXXXy\toolbox\<Toolbox Name>\supportpackages\<Support Package Name>\<examples>)
>> rehash path
5. In some instances, Support Package examples vary from release to release.
Confirm that the example you are looking for exists in the MATLAB version you are trying to access it from. Refer to the documentation pages for your specific MATLAB version, and confirm that the example appears listed somewhere in the version-specific documentation.