convertDefaultToPreferred - Convert default variant configuration to preferred variant

  configuration - MATLAB ([original](https://www.mathworks.com/help/simulink/slref/simulink.variantconfigurationdata.convertdefaulttopreferred.html)) ([raw](?raw))

Main Content

Convert default variant configuration to preferred variant configuration

Since R2022b

Syntax

Description

DefaultConfiguration property of a variant configuration data object will be removed. Use thePreferredConfiguration property instead (since R2022b) to indicate the configuration that is suited for the model for common workflows. If the variant configuration data object associated with your model has a value set for theDefaultConfiguration property, you can use it to set thePreferredConfiguration property using theconvertDefaultToPreferred function.

For more information, see DefaultConfigurationName and SubModelConfiguration properties will be removed.

Note

This function requires Variant Manager for Simulink®.

convertDefaultToPreferred([varconfigdata](#mw%5F85bc3e38-4276-433d-8e53-7e405c8ccfb3)) sets the value of the PreferredConfiguration property ofvarconfigdata to the value of theDefaultConfiguration property, and then clears theDefaultConfiguration property. varconfigdata is a Simulink.VariantConfigurationData object.

convertDefaultToPreferred([varconfigdata](#mw%5F85bc3e38-4276-433d-8e53-7e405c8ccfb3),[model](#mw%5F7d71f8c4-c612-41a2-a1cf-516a5a29c58b),[Name=Value](#namevaluepairarguments)) specifies options using one or more name-value arguments to additionally activate the preferred variant configuration on model by updating the callback functions of the model.

The preferred variant configuration is not applied automatically when compiling or simulating a model. You must apply the preferred configuration explicitly on the model, if required. To additionally activate the preferred configuration on the model, you can set theName=Value arguments in this function to add commands to thePostLoadFcn or InitFcn callbacks or both.

example

Examples

collapse all

Convert an existing default configuration of a variant configuration data object to its preferred configuration, and clear the default configuration.

convertDefaultToPreferred(varconfigdata);

Convert the configuration and update both theInitFcn and PostLoadFcn callbacks of the modelmodelname to activate the preferred configuration.

convertDefaultToPreferred(varconfigdata,modelname, ... AddActivateToPostLoadFcn=true,AddActivateToInitFcn=true);

Input Arguments

collapse all

Variant configuration data for which you want to set the preferred configuration, specified as a Simulink.VariantConfigurationData object.

Name of the model with which varconfigdata is associated, specified as a character vector or string scalar.

Example: "slexVariantManagement"

Data Types: char | string

Name-Value Arguments

collapse all

Specify optional pairs of arguments asName1=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: AddActivateToPostLoadFcn=true

Option to activate the preferred configuration by adding commands to thePostLoadFcn callback of the model, specified as a numeric or logical 1 (true) or 0 (false).

Example: true

Data Types: logical

Option to activate the preferred configuration by adding commands to theInitFcn callback of the model, specified as a numeric or logical1 (true) or 0 (false).

Example: true

Data Types: logical

Version History

Introduced in R2022b