Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

get_param - Get system and block parameter values

Syntax

paramValue = get_param(object, paramName)
paramValues = get_param(objectCellArray, paramName)
paramValue = get_param(objectHandle, paramName)
paramValue = get_param(0, paramName)
paramStruct = get_param(object, 'ObjectParameters')
paramCellArray = get_param(object, 'DialogParameters')

Description

paramValue = get_param(object, paramName) returns the value of the specified parameter. Some parameters are case-sensitive, and some are not. To prevent problems, treat all parameters as case-sensitive.

paramValues = get_param(objectCellArray, paramName) accepts a cell array of full path specifiers, enabling you to get the values of a parameter common to all objects specified in the cell array.

paramValue = get_param(objectHandle, paramName) returns the value of the specified parameter of the object whose handle is objectHandle.

paramValue = get_param(0, paramName) returns the current value of a Simulink session parameter or the default value of a model or block parameter.

paramStruct = get_param(object, 'ObjectParameters') returns a structure that describes object's parameters.

paramCellArray = get_param(object, 'DialogParameters') returns a cell array containing the names of object's dialog parameters.

Inputs

object

A model object for which get_param is to return a specified parameter value.

objectCellArray

A cell array of full path specifiers of objects for which get_param is to return the values of a specified parameter.

objectHandle

A handle to a model object for which get_param is to return a specified parameter value.

paramName

The name of a parameter for which get_param is to return a value or values.

Outputs

paramCellArray

A cell array containing the names of the dialog parameters of object.

paramStruct

A structure containing information about the parameters of object. Each field of the structure corresponds to the parameter with the same name as the field. Each field contains three subordinate fields: Type, Enum (if applicable), and Attributes. These fields respectively specify the parameter's data type, enumerated values (if applicable) , and attributes.

paramValue

The value of the parameter specified by paramName.

paramValues

A list containing the value of the parameter specified by paramName in each object specified in objectCellArray.

Examples

Return the value of the Gain parameter for the Inertia block in the Requisite Friction subsystem of the clutch system:

get_param('clutch/Requisite Friction/Inertia','Gain')
ans =
   1/(Iv+Ie)
 

Display the block types of all blocks in the current system:

blks = find_system(gcs, 'Type', 'block');
listblks = get_param(blks, 'BlockType')

listblks = 

    'SubSystem'
    'Inport'
    'Constant'
    'Gain'
    'Sum'
    'Outport'
 

Return the name of the currently selected block:

get_param(gcb, 'Name')
 

Get the attributes of the currently selected block's Name parameter:

p = get_param(gcb, 'ObjectParameters');
a = p.Name.Attributes

ans = 
    'read-write'    'always-save'
 

Get the dialog parameters of a Sine Wave block:

p = get_param('untitled/Sine Wave', 'DialogParameters')
p = 
          SineType: [1x1 struct]
        TimeSource: [1x1 struct]
         Amplitude: [1x1 struct]
              Bias: [1x1 struct]
         Frequency: [1x1 struct]
             Phase: [1x1 struct]
           Samples: [1x1 struct]
            Offset: [1x1 struct]
        SampleTime: [1x1 struct]
    VectorParams1D: [1x1 struct]

See Also

find_system | gcb | set_param

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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