Main Content

simscape.instrumentation.isLoggingEnabled

Return whether block variables have logging enabled

Since R2024a

    Description

    result = simscape.instrumentation.isLoggingEnabled(blockName) returns a logical 0 or 1 depending on whether logging variables are selected for the block, blockName.

    example

    Examples

    collapse all

    This example shows how to check whether logging is enabled for the Ideal Torque Source block labeled Load Torque in the Permanent Magnet DC Motor example.

    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 the block has logging enabled, enter:

    simscape.instrumentation.isLoggingEnabled('PermanentMagnetDCMotor/Load Torque')
    ans =
    
      logical
    
       1

    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

    Logical true or false result when logging is enabled or disabled for the block, respectively. Logical true and false correspond to 0 and 1, respectively.

    Version History

    Introduced in R2024a

    expand all