Main Content

simscape.instrumentation.setVariableTable

Set VariableTable object for block

Since R2024a

    Description

    example

    simscape.instrumentation.setVariableTable(blockName,VariableTable) sets the variable table, VariableTable, for the block, blockName. The variable table can by empty or it can have variables selected for logging. To log the variables, enable logging for the block.

    Examples

    collapse all

    This example shows how to set 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')

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

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

    To change the logging status of the t variable, enter:

    table1("t").Logging = true
    table1 = 
    
    VariableTable (string ⟼ VariableConfiguration) with 5 variable(s):
     
                    Name       Unit     Logging
                  _________    _____    _______
    
        C.w ⟼    <missing>    rad/s     false 
        R.w ⟼    <missing>    rad/s     false 
        S   ⟼    <missing>    N*m       false 
        t   ⟼    <missing>    N*m       true  
        w   ⟼    <missing>    rad/s     false 

    To set table1 as the variable table for the Load Torque block, enter:

    simscape.instrumentation.setVariableTable('PermanentMagnetDCMotor/Load Torque',table1)

    To confirm that you properly set the variable table as table1, confirm that the logging status for t is true. Enter:

    simscape.instrumentation.getVariableTable('PermanentMagnetDCMotor/Load Torque')
    ans = 
    
    VariableTable (string ⟼ VariableConfiguration) with 5 variable(s):
     
                    Name       Unit     Logging
                  _________    _____    _______
    
        C.w ⟼    <missing>    rad/s     false 
        R.w ⟼    <missing>    rad/s     false 
        S   ⟼    <missing>    N*m       false 
        t   ⟼    <missing>    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

    Variable table to apply to the block.

    Version History

    Introduced in R2024a