qc_get_network_interfaces qc_is_parameter navigation bar

Table of Contents

qc_get_parameter

Get a Simulink object parameter, returning the default value if the parameter does not exist.

Syntax

value = qc_get_parameter(object, parameter, default_value)  % Get parameter of object. Return default_value if no such parameter.
value = qc_get_parameter(object, parameter)                 % Get parameter of object. Throws exception if no such parameter.
    

Description

Gets the value of a parameter of a Simulink object. If the parameter does not exist, it returns the specified default value. If no default value is provided, then it throws an exception if the parameter does not exist (it is equivalent to get_param in that case).

The object parameter may be a string identifying a Simulink model or block, a handle to a model or block, or a cell array of strings and/or handles. The special value of 0 is used for the Simulink session itself, and provides the default value of a model or block parameter.

If object is a cell array, then it returns a cell array containing the value of the parameter for each object in the array. The default value will be returned if any of the objects in the cell array do not have a parameter corresponding to the given parameter argument.

If the parameter argument is 'ObjectParameters' then a structure that describes the object's parameters is returned. Each field of the structure corresponds to a particular parameter and has the same name as the parameter. Each field contains three subfields:

Field Name

Description

Type

The data type of the parameter.

Enum

A cell array of possible values (for popupmenus).

Attributes

A cell array of attributes, such as read-only..

If the parameter argument is 'DialogParameters' then a cell array of strings containing the names of the dialog parameters is returned.

Parameters

object

A string or handle identifying a Simulink object. Use 0 for the Simulink session. It can also be a cell array of strings and/or handles.

parameter

A string containing the name of the parameter to retrieve.

default_value

The default value to return if the parameter does not exist.

Outputs

value

The value(s) of the parameter(s).

Examples

% Get value of FooBar parameter. If it doesn't exist, return 25.
value = qc_get_parameter('mymodel/myblock', 'FooBar', 25);
    

See Also

 

navigation bar