Cache compilation artifacts
Option to disable caching of compilation artifacts
Since R2025a
Model Configuration Pane: Simscape
Description
Simscape™ software speeds up compilation of large models by automatically caching compilation artifacts for use in subsequent compilations.
In general, keep the caching on. You can turn off caching of compilation artifacts when:
Your model contains a custom block that relies on its declaration function generating random parameter or variable values at every simulation run. In this case, caching can lead to unexpected simulation results because declaration function values are reused for subsequent simulation runs and therefore are no longer random. For more information on declaration functions, see Declaration Functions.
This restriction applies only if you use functions like
rand
,randi
, orrandn
inside a MATLAB® declaration function. If you callrand
,randi
, orrandn
directly from Simscape code, for example, use it in a Simscape function or directly in a parameter declaration, caching does not apply and you can keep the default setting for the Cache compilation artifacts parameter.You are profiling the compilation performance of a model over multiple runs and want to get comparable results.
Settings
- On
Cache model compilation artifacts.
- Off
Disable caching of compilation artifacts. This option slows down model compilation. Use it only for special situations, like profiling compilation performance, or if your model contains custom blocks with declaration functions and relies on a declaration function generating random parameter or variable values at every simulation run.
Recommended Settings
Application | Setting |
---|---|
Debugging | No Impact |
Traceability | No Impact |
Efficiency | On |
Safety precaution | No Impact |
Programmatic Use
Parameter:
SimscapeCacheCompileArtifacts |
Type: character vector | string scalar |
Value:
'on' | 'off' |
Default:
'on' |
Version History
Introduced in R2025a