Share the generated code for various target types between team members inside an
organization by using Simulink® cache files. When you generate code from a Simulink model hierarchy, each referenced model has an associated Simulink cache file. These files have an
.slxc file extension.
The cache files contain artifacts from the build that can reduce the time required for
successive model simulation and code generation. Simulink cache files are generated when you simulate models in accelerator or rapid
accelerator mode or generate code for models. For more information, see Share Simulink Cache Files for Faster Simulation.
At the end of a build, the code generator packages the artifacts and generated code for the model hierarchy in the Simulink cache files. The cached artifacts include:
All files under the
folder for the top model
Any binaries generated for the top model
You cannot modify the contents of the Simulink cache files. If you update the build artifacts inside the
slprj folder, the Simulink cache file picks up these updates during the next build cycle.
If you are involved in team development of large models that reference other models, use Simulink cache files to synchronize builds and share generated code artifacts to enhance incremental code generation. You can leverage Simulink cache files to avoid unnecessary code generation.
For example, assume that you collaborate with your team members by using a source control system and your models are built every night in a continuous integration system.
Open your model. For example,
Build the model. On the C Code tab, click Build.
Observe the Simulink cache files generated for all referenced models. The
rtwdemo_mdlrefbot model is a referenced model in
Simulink stores cache files in the folder specified by the Simulation cache folder preference.
To see all supported configurations, double-click the cache file. The Simulink cache report contains information related to each release, platform, and list of packaged targets.
Alternatively, to get the contents of the Simulink cache file in a MATLAB® table, use the
Submit your models to the source control system. The continuous integration system builds the models overnight and updates the existing Simulink cache files.
Because Simulink cache files are derived files, do not submit them to source control. If you share Simulink cache files by storing them in a source control system, you cannot diff or merge different versions of these files.
Assume your team member made some changes to the model and submitted the changes to the source control system. When you want to work with the model hierarchy, fetch these files:
Design files (model and associated files) from the source control system.
Simulink cache files from the continuous integration system.
Make your changes to the model.
Build the model. The code generator extracts code generation artifacts stored in the Simulink cache files from the overnight build and avoids unnecessary rebuilds and code regeneration.
The time to build the model and generate code is less than the first time that you built the model.
To unpack the simulation and code generation targets from the
Simulink cache files without updating, simulating, or
generating code for the model hierarchy, use the
Submit your updated model files to the source control system.