Contenu principal

mergePublishedModels

R2026b

Merge published models into one file

Since R2026b

Description

mergePublishedModels(pubmdls) merges the published model files specified by pubmdls into one published model file.

The published model files must have the same source model name and compatible build artifacts. You cannot merge files with overlapping functionality. For example, for model reference simulation, at least one of the release, compiler, or platform must differ.

The output file uses the default filename derived from the source model name.

example

mergePublishedModels(pubmdls,fileout) merges the published model files into the output file specified by fileout.

example

Examples

collapse all

Suppose your team uses both Windows® and Linux® machines. For each source model, you want a continuous integration (CI) system to generate one published model file that contains both the Windows and Linux build artifacts.

The CI system publishes a model on a Windows machine. To prevent merge conflicts, the CI system appends a _win64 suffix to the published model filename. Suppose the published model supports the functionality in this table.

mymodel_win64.slxp

Supported FunctionalityReleasePlatformCompiler
Model reference simulationR2026bwin64mingw64
Model reference code generationR2026bwin64mingw64

The CI system publishes the same model on a Linux machine. To prevent merge conflicts, the CI system appends a _glnxa64 suffix to the published model filename. Suppose the published model supports the functionality in this table.

mymodel_glnxa64.slxp

Supported FunctionalityReleasePlatformCompiler
Model reference simulationR2026bglnxa64gcc
Model reference code generationR2026bglnxa64gcc

Configure the CI system to copy the published models to a centralized machine.

To merge the published model files, configure the CI system to use the mergePublishedModels function.

mergePublishedModels(["mymodel_win64.slxp","mymodel_glnxa64.slxp"])

The function generates a published model that supports the functionality in this table. By default, the filename uses the name of the source model.

mymodel.slxp

Supported FunctionalityReleasePlatformCompiler
Model reference simulationR2026bwin64mingw64
Model reference simulationR2026bglnxa64gcc
Model reference code generationR2026bwin64mingw64
Model reference code generationR2026bglnxa64gcc

The CI system places the merged published model file in a build archive.

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

Suppose you have two published model files for the same source model.

To merge them into one published model file in a custom location with a custom filename, specify the output file with a relative or absolute path.

mergePublishedModels(["mymodel_win64.slxp","mymodel_glnxa64.slxp"], ...
    "C:/output/mymodel_merged.slxp")

The function creates the merged published model file at the specified path with the specified name.

Input Arguments

collapse all

Published model files to merge, specified as a string or cell array of character vectors.

Each element must specify a published model file (.slxp) using an absolute or relative path.

The published model files must have the same source model name and compatible build artifacts. You cannot merge files with overlapping functionality. For example, for model reference simulation, at least one of the release, compiler, or platform must differ.

Example: mergePublishedModels(["model_win64.slxp","model_glnxa64.slxp"])

Data Types: string | cell

Output filename or path, specified as a string or character vector.

The default output filename is the model name with a .slxp extension.

The filename must include the .slxp extension, the filename without the extension must be a valid MATLAB® variable name, and the file must not already exist.

If the specified path does not exist, the software attempts to create the path.

Example: mergePublishedModels(pubmdls,"C:/output/mymodel.slxp")

Data Types: char | string

Version History

Introduced in R2026b