The build process places generated files from Simulink® diagram updates and model builds into a hierarchy of folders that is specified by default. You can change the default specification for build process folders, if, for example:
Your company does not use the current working folder as the location for the code generation folder or the simulation cache folder.
You place the code generation folder under version control, but do not place the simulation cache folder under version control.
The MATLAB® session parameters CacheFolder
,
CodeGenFolder
, and CodeGenFolderStructure
are file
generation control parameters that specify the folder locations for the build process. At the
start of a MATLAB session, these Simulink preferences determine the values of the parameters:
Simulation cache folder –
CacheFolder
Code generation folder –
CodeGenFolder
Code generation
folder structure – CodeGenFolderStructure
To modify the parameters during a MATLAB session, use Simulink.fileGenControl
. The parameter values that
you set expire at the end of the MATLAB session.
This table provides information about how you can use the parameters to manage build process folders.
MATLAB Session Parameter | Simulink Preference | Description |
---|---|---|
| Simulation cache folder | The build process places generated files from Simulink diagram updates and model build artifacts for simulation and code
generation in the simulation cache folder
By default ( You can use the parameter to specify another folder. For example, if you want to:
|
| Code generation folder |
The build process, which uses system target files to generate production
code from a Simulink model, places the production code in the code generation folder
If you choose to generate an executable program file, the build process
writes the file By default ( You can use the parameter to specify another folder. For example, if you want to separate generated production code from:
If you specify the root folder of a drive as the code generation folder, the
build process cannot generate code for your model. For example,
|
| Code generation folder structure | To specify the folder structure within the code generation folder, use the parameter. For example, if you configure models for different target environments, you can specify a separate subfolder for the generated code from each model. |
This table provides information about how
CodeGenFolderStructure
controls the folder structure within the
simulation cache folder and the code generation folder.
Folder Name when |
Folder Name when | Description |
---|---|---|
The default for |
The build process uses configuration information for the system target file
and the hardware device to produce a unique label for the subfolder,
| Build folder, which stores generated source code and other files created by the build process. Contains the generated code modules,
|
|
| Code generation report folder that contains report files generated by the build process. |
|
|
Model reference target files. |
|
|
Header files from models referenced by
|
|
|
MAT-files used during code generation. |
|
| Utility functions for model reference system target files, which are shared across models. Folder also contains
|
|
|
Simulation target files for referenced models. |
|
|
MAT-files used during code generation. |
|
|
Utility functions for simulation system target files, which are shared across models. |
If the system target file is ERT-based, then these model configuration parameters also control the location of shared utility code:
Shared code placement
(UtilityFuncGeneration
)
Existing shared code
(ExistingSharedCode
)
You can use RTW.getBuildDir
to display build folder
information for the model.
RTW.getBuildDir
| Simulink.fileGenControl