Main Content

slxcunpack

Unpack simulation and code generation targets from Simulink cache file

Since R2020b

Description

fileinfo = slxcunpack(filename) unpacks the simulation and code generation artifacts from the Simulink® cache file specified by filename for the current platform, MATLAB® release, and compiler, when applicable. Code generation artifacts must apply to the current system target file and folder configuration.

When using this function, consider these limitations:

  • Do not use this function during model callbacks, model updates, simulation, or code generation. This function loads the model associated with the Simulink cache file.

  • Do not use this function as part of asynchronous functions, such as parfor and parfeval.

  • The contents of the Simulink cache file might be out of date. Simulation and code generation can update the artifacts on disk and in the Simulink cache file.

example

fileinfo = slxcunpack(filename,Name=Value) specifies options using one or more name-value arguments.

example

Examples

collapse all

Suppose you have this setup:

  • R2025a MATLAB release.

  • 64-bit Windows® operating system.

  • MinGW® compiler.

  • grt.tlc system target file — For more information, see System target file (Simulink Coder).

  • Model specific code generation folder structure — For more information, see Code generation folder structure.

You also have two Simulink cache files:

  • CounterSystem.slxc is a Simulink cache file for the top model in a model hierarchy.

  • CounterAlgorithm.slxc is a Simulink cache file for the only referenced model in the model hierarchy.

To unpack the simulation and code generation artifacts that correspond to your setup from the Simulink cache file, you would enter this command.

fileinfo = slxcunpack("CounterSystem.slxc")
fileinfo =

  5×5 table

          Model           Release     Platform                     Target                               Compiler           
    __________________    ________    ________    ________________________________________    _____________________________

    "CounterSystem"       "R2025a"    "win64"     "Rapid accelerator target"                  "MinGW64 Compiler (C) v8.1.0"
    "CounterSystem"       "R2025a"    "win64"     "Accelerator target"                        ""                           
    "CounterSystem"       "R2025a"    "win64"     "grt | Top model | Model specific"          "MinGW64 Compiler (C) v8.1.0"
    "CounterAlgorithm"    "R2025a"    "win64"     "Model reference simulation target"         "MinGW64 Compiler (C) v8.1.0"
    "CounterAlgorithm"    "R2025a"    "win64"     "grt | Model reference | Model specific"    "MinGW64 Compiler (C) v8.1.0"

The returned table lists the artifacts that the function unpacks into the Simulation cache folder and Code generation folder.

Suppose you have this setup:

  • R2025a MATLAB release

  • 64-bit Windows operating system

  • MinGW compiler for 64-bit Windows operating system

You also have two Simulink cache files:

  • CounterSystem.slxc is a Simulink cache file for the top model in a model hierarchy.

  • CounterAlgorithm.slxc is a Simulink cache file for the only referenced model in the model hierarchy.

To unpack the simulation artifacts that correspond to your setup from the Simulink cache file and display status messages, you would enter this command.

fileinfo = slxcunpack("CounterSystem.slxc", Target="Simulation", ...
Verbose=true)
### Rapid accelerator target for 'CounterSystem': Unpacked.
### Accelerator target for 'CounterSystem': Unpacked.
### Model reference simulation target for 'CounterAlgorithm': Unpacked.

fileinfo =

  3×5 table

          Model           Release     Platform                  Target                             Compiler           
    __________________    ________    ________    ___________________________________    _____________________________

    "CounterSystem"       "R2025a"    "win64"     "Rapid accelerator target"             "MinGW64 Compiler (C) v8.1.0"
    "CounterSystem"       "R2025a"    "win64"     "Accelerator target"                   ""                           
    "CounterAlgorithm"    "R2025a"    "win64"     "Model reference simulation target"    "MinGW64 Compiler (C) v8.1.0"

The returned table lists the artifacts that the function unpacks into the Simulation cache folder.

Input Arguments

collapse all

Name of the Simulink cache file, including the .slxc extension, specified as a character vector or string scalar.

The Simulink cache file must be in the Simulation cache folder, which, by default, is the current working folder (pwd).

Data Types: char | string

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: slxcunpack("model.slxc", Target="Simulation")

Type of target to unpack, specified as "All", "Simulation", or "CodeGeneration". If "All", the function unpacks both simulation and code generation targets.

The unpacked simulation targets can be accelerator targets, rapid accelerator targets, and model reference simulation targets.

Data Types: char | string

Option to unpack referenced model targets, specified as true or false. If true, the function also unpacks the Simulink cache files that correspond to referenced models.

Data Types: logical

Option to display status messages, specified as true or false.

Data Types: logical

Output Arguments

collapse all

Unpacked Simulink cache file contents, returned as a MATLAB table.

Version History

Introduced in R2020b

expand all