Simulink.ConfigSetRef

Link model to configuration set stored independently of any model

Description

Instances of this handle class allow a model to reference configuration sets that exist outside any model. See Manage a Configuration Set, Overview, and Manage a Configuration Reference for more information.

Property Summary

Name

Description

Description

Description of the configuration reference.

Name

Name of the configuration reference.

WSVarNameName of the workspace variable that contains the referenced configuration set.

Method Summary

Name

Description

copy

Create a copy of a configuration reference.

getFullName

Get the full pathname of a configuration reference.

getModel

Get the handle of the model that owns a configuration reference.

get_param

Get the value of a configuration set parameter indirectly through a configuration reference.

getRefConfigSetGet the configuration set specified by a configuration reference.
isActive

Determine whether a configuration reference is the active configuration object of the model.

refreshUpdate configuration reference after any change to properties or configuration set availability.

Properties

Description

Description

Description of the configuration reference. You can use this property to provide additional information about a configuration reference, such as its purpose. This field can remain blank.

Data Type

string

Access

RW

Name

Description

Name of the configuration reference. This name represents the configuration reference in the GUI.

Data Type

string

Access

RW

WSVarName

Description

Name of the workspace variable that contains the referenced configuration set.

Data Type

string

Access

RW

Methods

copy

Purpose

Create a copy of this configuration reference.

Syntax

copy

Description

This method creates a copy of this configuration set.

    Note   You must use this method to create copies of configuration references. This is because Simulink.ConfigSetRef is a handle class. See Handle Versus Value Classes for more information.

getFullName

Purpose

Get the full pathname of a configuration reference.

Syntax

getFullName

Description

This method returns a string specifying the full pathname of a configuration reference, e.g., 'vdp/Configuration'.

getModel

Purpose

Get the model that owns this configuration reference.

Syntax

getModel

Description

Returns a handle to the model that owns this configuration reference.

example

The following command opens the block diagram of the model that owns the configuration set referenced by the MATLAB® workspace variable hCr.

open_system(hCr.getModel);

get_param

Purpose

Get the value of a configuration set parameter indirectly through a configuration reference.

Syntax

get_param(paramName)

Arguments

paramName

String specifying the name of the parameter whose value is to be returned.

Description

This method returns the value of the specified parameter from the configuration set to which the configuration reference points. To obtain this value, the method uses the value of WSVarName to retrieve the configuration set, then retrieves the value of paramName from that configuration set. Specifying paramName as 'ObjectParameters' returns the names of all valid parameters in the configuration set. If a valid configuration set is not attached to the configuration reference, the method returns unreliable values.

The inverse method, set_param, is not defined for configuration references. To obtain a parameter value through a configuration reference, you must first use the getRefConfigSet method to retrieve the configuration set from the reference, then use set_param directly on the configuration set itself.

You can also use the get_param model construction command to get the values of parameters of a model's active configuration set, e.g., get_param(bdroot, 'SolverName') gets the solver name of the currently selected model.

example

The following command gets the name of the solver used by the selected model's active configuration.

hAcs = getActiveConfigSet(bdroot);
hAcs.get_param('SolverName');

getRefConfigSet

Purpose

Get the configuration set specified by a configuration reference

Syntax

getRefConfigSet

Description

Returns a handle to the configuration set specified by the WSVarName property of a configuration reference.

isActive

Purpose

Determine whether this configuration set is its model's active configuration set.

Syntax

isActive

Description

Returns true if this configuration set is the active configuration set of the model that owns this configuration set.

refresh

Purpose

Update configuration reference after any change to properties or configuration set availability

Syntax

refresh

Description

Updates a configuration reference after using the API to change any property of the reference, or after providing a configuration set that did not exist at the time the set was originally specified in WSVarName. If you omit executing refresh after any such change, the configuration reference handle will be stale, and using it will give incorrect results.

Was this topic helpful?