主要内容

slxcmerge

Merge Simulink cache files in new file

Since R2026a

Description

slxcmerge(mdl,src) merges Simulink® cache files specified by src in a new Simulink cache file in the current folder. The model name specified by mdl must correspond with the Simulink cache files specified by src. The current folder must not already contain a Simulink cache file for the specified model.

example

slxcmerge(mdl,src,dest) specifies the destination of the new Simulink cache file.

Examples

collapse all

Suppose your team uses both Windows® and Linux® machines. A continuous integration (CI) system builds models overnight and generates separate Simulink cache files for Windows and Linux build artifacts. For each model, you want the CI system to generate one Simulink cache file that contains both the Windows and Linux build artifacts.

Suppose a Simulink cache file generated on a Windows machine contains these build artifacts for a model:

  • Windows R2026a accelerator target

  • Windows R2026a C and C++ code generation target

  • R2026a variable usage information

For the same model, a Simulink cache file generated on a Linux machine contains these build artifacts:

  • Linux R2026a accelerator target

  • Linux R2026a C and C++ code generation target

  • R2026a variable usage information

Configure the CI system to copy the Simulink cache files to a centralized machine. To avoid conflicts, use unique folders for each platform and release.

Suppose the CI system copies the Simulink cache files to these folders:

  • C:\simcache\R2026a\win64 — Windows Simulink cache files

  • C:\simcache\R2026a\glnxa64 — Linux Simulink cache files

To merge the Simulink cache file contents, configure the CI system to use the slxcmerge function.

slxcwin = "C:\simcache\R2026a\win64"
slxcglnxa = "C:\simcache\R2026a\glnxa64"
slxcmerge("mymodel",[slxcwin,slxcglnxa])

In this example, the slxcmerge function generates a Simulink cache file that contains these build artifacts for the specified model:

  • Windows R2026a accelerator target

  • Windows R2026a C and C++ code generation target

  • Linux R2026a accelerator target

  • Linux R2026a C and C++ code generation target

  • R2026a variable usage information

The CI system places the merged Simulink cache file in a build archive.

You and your team members copy the merged Simulink cache file from the build archive. Depending on the platform you use, the software extracts the relevant Windows or Linux build artifacts from the Simulink cache file.

Input Arguments

collapse all

Model name, specified as a string scalar or character vector.

Example: slxcmerge("mymodel",["C:\simcache\win64","C:\simcache\glnxa64"]) merges Simulink cache files for a model named mymodel.

Data Types: char | string

Source folders of Simulink cache files, specified as a string array or cell array.

For a model named mymodel, each corresponding Simulink cache file is named mymodel.slxc. Given the common filename, specify the Simulink cache files by their locations.

Across the specified Simulink cache files:

  • Platform-specific artifacts, such as simulation and code generation targets, must be unique. To support a merge and avoid conflicts, equivalent artifacts must differ by release or platform.

  • Platform-independent artifacts, such as variable usage information, can overlap. The software uses the first instance found for platform-independent artifacts.

Example: slxcmerge("mymodel",["C:\simcache\win64","C:\simcache\glnxa64"]) merges Simulink cache files stored in the "C:\simcache\win64" and "C:\simcache\glnxa64" folders.

Data Types: string | cell

Destination folder for new Simulink cache file, specified as a string scalar or character vector.

By default, the function uses the current folder specified by pwd.

The destination folder must not already contain a Simulink cache file for the specified model.

If the specified folder does not exist, the function creates the folder.

Example: slxcmerge("mymodel",["C:\simcache\win64","C:\simcache\glnxa64"],"C:\simcache\merged") stores the new Simulink cache file in the "C:\simcache\merged" folder.

Data Types: char | string

Version History

Introduced in R2026a