If you specify paths and files with absolute paths and later move them, you must change these paths to point to new locations. To avoid this problem, use relative paths for custom code options that specify paths or files.
Search paths exist relative to these folders:
The current folder
The model folder (if different from the current folder)
The custom list of folders that you specify
All the folders on the MATLAB® search path, excluding the toolbox folders
When you construct relative paths for custom code, follow these syntax rules:
You can use the forward slash (
or backward slash (
\) as a file separator, regardless
of whether you are on a UNIX® or PC platform. The makefile generator
returns the path names with the correct platform-specific file separators.
You can use tokens that evaluate in the MATLAB workspace,
if you enclose them with dollar signs (
For example, consider this path:
In this example,
mydir1 is a variable that
you define in the MATLAB workspace as
In the generated code, this custom include path appears as:
You must enclose paths in double quotes if they contain spaces or other nonstandard path characters, such as hyphens (-).