Main Content

simscape.instrumentation.VariableConfiguration

Configuration for variable

Since R2024a

    Description

    simscape.instrumentation.VariableConfiguration is a configuration for a variable.

    simscape.instrumentation.VariableConfiguration returns a VariableConfiguration object that contains the default values for a variable. You can use the VariableConfiguration object to configure settings for a block variable. Simscape stores the object as a value in a simscape.instrumentation.VariableTable object.

    Creation

    You create this object with default values when you configure a block variable in a simscape.instrumentation.VariableTable object.

    Properties

    expand all

    Alias for a given block variable, specified as a character vector or string scalar. You can apply an alias to a variable to track or access that variable.

    Data Types: string

    Units for a given block variable, specified as a simscape.Unit object. Use this property to specify what unit Simscape uses to record a given block variable.

    Data Types: simscape.Unit

    Whether the data for a given variable is enabled for logging, specified as false or true.

    Data Types: matlab.lang.OnOffSwitchState

    Examples

    collapse all

    1. To create a VariableTable object and save it as a workspace variable, enter:

      table1 = simscape.instrumentation.VariableTable
      table1 = 
      
        VariableTable with unset variable(s)

    2. Consider a Simscape block with the variable C.w. To configure the variable for logging, you must make a variable configuration to store the selective logging settings. To make a variable configuration for the variable C.w, enter:

      table1("C.w") = simscape.instrumentation.VariableConfiguration
      table = 
      
        VariableTable (string ⟼ VariableConfiguration) with 1 variable(s):
      
                      Name       Unit    Logging
                    _________    ____    _______
      
          C.w ⟼    <missing>     ""      false 

    3. You can also the insert object function to add a variable configuration.

      table1 = insert(table1, "R.w", simscape.instrumentation.VariableConfiguration)
      table1 = 
      
        VariableTable (string ⟼ VariableConfiguration) with 2 variable(s):
      
                      Name       Unit    Logging
                    _________    ____    _______
      
          C.w ⟼    <missing>     ""      false 
          R.w ⟼    <missing>     ""      false 
      

    4. You can use the VariableConfiguration object properties to change the variable configuration.

      table1("C.w").Name = "Port C Speed";
      table1("C.w").Unit = "rpm";
      table1("C.w").Logging = "on"
      table1 = 
      
        VariableTable (string ⟼ VariableConfiguration) with 2 variable(s):
      
                         Name          Unit      Logging
                    ______________    _______    _______
      
          C.w ⟼    "Port C Speed"    {[rpm]}     true  
          R.w ⟼    <missing>         {["" ]}     false 

    Version History

    Introduced in R2024a