Simulink.ConfigSet - Access model configuration set

Description

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.

Property Summary

Name

Description

Components

Components of the configuration set.

Description

Description of the configuration set.

Name

Name of the configuration set.

SimulationMode

Mode used for simulation with this configuration.

Method Summary

Name

Description

attachComponent

Attach a component to a configuration set.

copy

Create a copy of a configuration set.

getComponent

Get a component of a configuration set.

getFullName

Get the full pathname of a configuration set.

getModel

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

get_param

Get the value of a configuration set parameter.

isActive

Determine whether a configuration set is the active set of the model that owns it.

isValidParam

Determine whether a specified parameter is a valid parameter of a configuration set.

setPropEnabled

Prevent or allow a user to change a parameter.

set_param

Set the value of a configuration set parameter.

Properties

Components

Description

Array of Simulink.ConfigComponent objects representing the components of the configuration set, e.g., solver parameters, data import/export parameters, etc.

Data Type

array

Access

RW

Description

Description

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.

Data Type

string

Access

RW

Name

Description

Configuration set's name. This name represents the configuration set in the Model Explorer.

Data Type

string

Access

RW

SimulationMode

Description

Model's simulation mode. Valid values are normal, accelerator, or external.

Data Type

string

Access

RW

Methods

attachComponent

Purpose

Attach a component to this configuration set.

Syntax

attachComponent(component)

Arguments

component

Instance of Simulink.ConfigComponent class.

Description

This method replaces a component in this configuration set with a component having the same name.

Example

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);

copy

Purpose

Create a copy of this configuration set.

Syntax

copy

Description

This method creates a copy of this configuration set.

getComponent

Purpose

Get a component of this configuration set.

Syntax

getComponent(componentName)

Arguments

componentName

String specifying the name of the component to be returned.

Description

Returns the specified component. Omit the argument to get a list of the names of the components that this configuration set contains.

Example

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

getFullName

Purpose

Get the full pathname of a configuration set.

Syntax

getFullName

Description

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

getModel

Purpose

Get the model that owns this configuration set.

Syntax

getModel

Description

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

Example

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_param

Purpose

Get the value of a configuration set parameter.

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. Specifying paramName as 'ObjectParameters' returns the names of the valid parameters in the configuration set.

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');

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.

isValidParam

Purpose

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.

Syntax

isValidParam(paramName)

Arguments

paramName

String specifying the name of the parameter whose validity is to be determined.

Description

This method returns true if the specified parameter is a valid parameter of this configuration set; otherwise, it returns false.

Example

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');
end

setPropEnabled

Purpose

Enable a configuration set parameter to be changed.

Syntax

setPropEnabled(paramName, isEnabled)

Arguments

paramName

Name of the parameter whose value is to be set.

isEnabled

Specify as true to enable parameter; as false, to disable the parameter.

Description

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.

Example

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_param

Purpose

Set the value of a configuration set parameter.

Syntax

set_param(paramName, paramValue)

Arguments

paramName

Name of the parameter whose value is to be set.

paramValue

Value to assign to the parameter.

Description

This method sets the configuration set parameter specified by paramName to the value specified by paramValue.

Example

The following command sets the simulation stop time of the selected model's active configuration.

hAcs = getActiveConfigSet(gcs);
hAcs.set_param('StopTime', '20');

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS