Main Content

simscape.instrumentation.getVariableTable

Get current VariableTable object for block

Since R2024a

    Description

    example

    VariableTable = simscape.instrumentation.getVariableTable(blockName) returns the current variable table, VariableTable, associated with the block, blockName. The VariableTable object data includes each variable name, the variable alias, the units, and whether logging is enabled.

    Examples

    collapse all

    This example shows how to get the simscape.instrumentation.VariableTable object for the Ideal Torque Source block in the Permanent Magnet DC Motor example model.

    To open the model, enter:

    openExample('simscape/PermanentMagnetDCMotorExample')

    Store the default variable table for the Load Torque block.

    table = simscape.instrumentation.defaultVariableTable('PermanentMagnetDCMotor/Load Torque');

    Update the configuration of the default variable table and apply the table to the Load Torque block.

    table("t").Name = "var";
    table("t").Logging = on;
    table("C.w").Unit = simscape.Unit("deg/s");
    simscape.instrumentation.setVariableTable('PermanentMagnetDCMotor/Load Torque', table)

    To get the variable table for the Load Torque block, enter:

    VariableTable_Load_Torque = simscape.instrumentation.getVariableTable('PermanentMagnetDCMotor/Load Torque')
    VariableTable_Load_Torque = 
    
    VariableTable (string ⟼ VariableConfiguration) with 5 variable(s):
     
                   Name       Unit     Logging
                 _________    _____    _______
    
        C.w ⟼    <missing>    deg/s     false 
        R.w ⟼    <missing>    rad/s     false 
        S   ⟼    <missing>    N*m       false 
        t   ⟼    var          N*m       true 
        w   ⟼    <missing>    rad/s     false 

    Input Arguments

    collapse all

    Simscape block name, specified as a string scalar, character vector, or a handle.

    Data Types: double | char | string

    Output Arguments

    collapse all

    Block variable table, specified as a simscape.instrumentation.VariableTable object.

    Version History

    Introduced in R2024a