Simulink.exportToVersion

Export model, library, or project for use in previous version of Simulink

Description

example

exported_file = Simulink.exportToVersion(modelname,target_filename,version) exports the model or library modelname to a file named target_filename in a format that the specified previous Simulink® version can load.

If the system contains functionality not supported by the specified Simulink software version, the command removes the functionality and replaces any unsupported blocks with empty masked subsystem blocks colored yellow. As a result, the converted system may generate different results.

The save_system ExportToVersion option is a legacy option for this functionality that is also supported.

example

exported_file = Simulink.exportToVersion(modelname,target_filename,version,Name,Value) specifies additional options as one or more name-value pair arguments.

example

exported_project = Simulink.exportToVersion(proj,zipfilename,version) exports the project proj to a ZIP file zipfilename in a format that the specified previous Simulink version can load.

Examples

collapse all

Get the current top-level system and export it.

 Simulink.exportToVersion(bdroot,'mymodel.slx','R2014b');

Get the current top-level system and export it, replacing links to library blocks with copies of the library blocks in the saved file.

Simulink.exportToVersion(bdroot,'mymodel.slx','R2014b','BreakUserLinks',true);

Get the current top-level project and export it.

sldemo_slproject_airframe;
proj = currentProject;
Simulink.exportToVersion(proj,'myzipfilename','R2019a');

Input Arguments

collapse all

Model to export, specified as a character vector or string scalar, without any file extension. The model must be loaded and unmodified. The target file must not be the same as the model file.

Data Types: char | string

Exported file name, specified as a character vector or string scalar. The target file must not be the same as the model file.

Example: 'mymodel.slx'

Data Types: char | string

Project to export, specified as a matlab.project.Project object. Use currentProject to create a project object from the currently loaded project.

ZIP file name containing the exported project, specified as a character vector or string scalar.

Example: 'myzipfile.zip'

Data Types: char | string

MATLAB release name, specified as a character vector or string scalar, which specifies a previous Simulink version. Simulink.exportToVersion exports the system to a format that the specified previous Simulink version can load. You cannot export to your current version. These version names are not case sensitive.

You can specify model file format as SLX or MDL using the suffix _MDL or _SLX. If you do not specify a format, you export your default model file format.

If you use the Export to Previous Version dialog box instead of Simulink.exportToVersion, then the Save as type list supports 7 years of previous releases.

Example: 'R2015B'

Data Types: char | string

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example:

Allow prompt or message dialog box, specified by a logical value that indicates whether to display any output prompt or message in a dialog box or only messages at the command line. For example, prompts to make files writable, or messages about exported versions. If you want to allow prompts, then set to true. or on.

Output Arguments

collapse all

Path of the exported file, returned in the format that the specified previous Simulink version can load.

Path of the ZIP file containing the exported project, returned in the format that the specified previous Simulink version can load.

Limitations

Simulink.exportToVersion does not support exporting external test harnesses to previous releases.

  • For models with external test harnesses, Simulink.exportToVersion automatically converts them to internal test harnesses.

  • For projects containing models with external test harnesses, Simulink.exportToVersion exports the projects and reports the test harnesses as missing files.

Introduced in R2016a