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. SeeManage a Configuration Set,Overview, andManage a Configuration Referencefor more information.
Property Summary
Name |
Description |
---|---|
Description | Description of the configuration reference. |
Name | Name of the configuration reference. |
SourceName | Name of the variable in the workspace or the data dictionary that contains the referenced configuration set. |
Note
You can use theConfiguration Referencedialog box to set theName
,Description
, andSourceName
properties of a configuration reference. SeeCreate and Attach a Configuration Referencefor details.
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 | 得到一套配置参数的值irectly through a configuration reference. |
getRefConfigSet | Get the configuration set specified by a configuration reference. |
isActive | Determine whether a configuration reference is the active configuration object of the model. |
refresh | Update 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
character vector
Access
RW
Name
Description
Name of the configuration reference. This name represents the configuration reference in the GUI.
Data Type
character vector
Access
RW
SourceName
Description
Name of the variable in the workspace or the data dictionary that contains the referenced configuration set.
Data Type
character vector
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 becauseSimulink.ConfigSetRef
is a handle class. SeeHandle Versus Value Classesfor more information.
getFullName
Purpose
Get the full pathname of a configuration reference.
Syntax
getFullName
Description
This method returns a character vector 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 variablehCr
.
open_system(hCr.getModel);
get_param
Purpose
得到一套配置参数的值irectly through a configuration reference.
Syntax
get_param(
paramName
)
Arguments
-
paramName
-
Character vector 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 ofSourceName
to retrieve the configuration set, then retrieves the value ofparamName
from that configuration set. SpecifyingparamName
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 thegetRefConfigSet
method to retrieve the configuration set from the reference, then useset_param
directly on the configuration set itself.
You can also use theget_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 theSourceName
property of a configuration reference.
isActive
Purpose
Determine whether this configuration set is its model's active configuration set.
Syntax
isActive
Description
Returnstrue
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 inSourceName
. If you omit executingrefresh
after any such change, the configuration reference handle will be stale, and using it will give incorrect results.