| Simulink® | ![]() |
Instances of this handle class allow you to write programs to create, modify, and attach configuration sets to models. See Configuration Sets and Configuration Set API for more information.
Name | Description |
|---|---|
Components of the configuration set. | |
Description of the configuration set. | |
Name of the configuration set. | |
Mode used for simulation with this configuration. |
Note You can use the Model Configuration dialog box to set the Name and Description properties of a configuration set. See Model Configuration Dialog Box for more information. |
Name | Description |
|---|---|
Attach a component to a configuration set. | |
Create a copy of a configuration set. | |
Get a component of a configuration set. | |
Get the full pathname of a configuration set. | |
Get the handle of the model that owns a configuration set. | |
Get the value of a configuration set parameter. | |
Determine whether a configuration set is the active set of the model that owns it. | |
Determine whether a specified parameter is a valid parameter of a configuration set. | |
Prevent or allow a user to change a parameter. | |
Set the value of a configuration set parameter. |
Array of Simulink.ConfigComponent objects representing the components of the configuration set, e.g., solver parameters, data import/export parameters, etc.
array
RW
Description of the configuration set. You can use this property to provide additional information about a configuration set, such as its purpose. This field can remain blank.
string
RW
Configuration set's name. This name represents the configuration set in the Model Explorer.
string
RW
Model's simulation mode. Valid values are normal, accelerator, or external.
string
RW
Attach a component to this configuration set.
attachComponent(component)
Instance of Simulink.ConfigComponent class.
This method replaces a component in this configuration set with a component having the same name.
The following example replaces the solver component of the active configuration set of model A with the solver component of the active configuration set of model B.
hCs = getActiveConfigSet('B');
hSolverConfig = hCs.getComponent('Solver');
hSolverConfig = hSolverConfig.copy;
hCs = getActiveConfigSet('A');
hCs.attachComponent(hSolverConfig);Create a copy of this configuration set.
copy
This method creates a copy of this configuration set.
Note You must use this method to create copies of configuration sets. This is because Simulink.ConfigSet is a handle class. See Handle Versus Value Classes in Simulink User's Guide for more information. |
Get a component of this configuration set.
getComponent(componentName)
String specifying the name of the component to be returned.
Returns the specified component. Omit the argument to get a list of the names of the components that this configuration set contains.
The following code gets the solver component of the active configuration set of the currently selected model.
hCs = getActiveConfigSet(gcs);
hSolverConfig = hCs.getComponent('Solver');The following code displays the names of the components of the currently selected model's active configuration set at the MATLAB command line.
hCs = getActiveConfigSet(gcs); hCs.getComponent
Get the full pathname of a configuration set.
getFullName
This method returns a string specifying the full pathname of a configuration set, e.g., 'vdp/Configuration'.
Get the model that owns this configuration set.
getModel
Returns a handle to the model that owns this configuration set.
The following command opens the block diagram of the model that owns the configuration set referenced by the MATLAB workspace variable hCs.
open_system(hCs.getModel);
Get the value of a configuration set parameter.
get_param(paramName)
String specifying the name of the parameter whose value is to be returned.
This method returns the value of the specified parameter. Specifying paramName as 'ObjectParameters' returns the names of the valid parameters in the configuration set.
The following command gets the name of the solver used by the selected model's active configuration.
hAcs = getActiveConfigSet(bdroot);
hAcs.get_param('SolverName');Note 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. |
Determine whether this configuration set is its model's active configuration set.
isActive
Returns true if this configuration set is the active configuration set of the model that owns this configuration set.
Determine whether a specified parameter is a valid parameter of this configuration set. A parameter is valid if it is compatible with other parameters in the configuration set. For example, if SolverType is set to 'variable-step', FixedStep is an invalid parameter.
isValidParam(paramName)
String specifying the name of the parameter whose validity is to be determined.
This method returns true if the specified parameter is a valid parameter of this configuration set; otherwise, it returns false.
The following code sets the parameter StopTime only if it is a valid parameter of the currently selected model's active configuration set.
hAcs = getActiveConfigSet(gcs);
if hAcs.isValidParam('StopTime')
set_param('StopTime', '20');
endEnable a configuration set parameter to be changed.
setPropEnabled(paramName, isEnabled)
Name of the parameter whose value is to be set.
Specify as true to enable parameter; as false, to disable the parameter.
This method sets the enabled status the parameter specified by paramName to the value specified by isEnabled. Disabling a parameter prevents the user from changing it.
The following code prevents the user from setting the simulation stop time of the currently selected model.
hAcs = getActiveConfigSet(gcs);
hAcs.setPropEnabled('StopTime', false);Set the value of a configuration set parameter.
set_param(paramName, paramValue)
Name of the parameter whose value is to be set.
Value to assign to the parameter.
This method sets the configuration set parameter specified by paramName to the value specified by paramValue.
The following command sets the simulation stop time of the selected model's active configuration.
hAcs = getActiveConfigSet(gcs);
hAcs.set_param('StopTime', '20');Note You can also use the set_param model construction command to set the parameters of the active configuration set, e.g., set_param(gcs, 'StopTime', '20') sets the simulation stop time of the currently selected model. |
![]() | Simulink.BusElement | Simulink.ConfigSetRef | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |