Main Content

insert

Insert variable to probe into variable table object

Since R2024b

    Description

    newVariableTable = insert(variableTable,key,value) inserts a new row into the variable table object, variableTable, and returns the updated variable table object newVariableTable. The new row consists of a variable name, key, and a variable configuration for probing, value.

    example

    Examples

    collapse all

    This example shows how to configure a variable for probing and add it to a variable table.

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

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

    Insert an empty variable configuration for the variable w into this table:

    table1 = insert(table1,"w",simscape.probe.VariableConfiguration)
    table1 = 
    
      VariableTable with 1 variable(s):
    
                 Unit     PortLabel    Probing
                ______    _________    _______
    
        w ⟼    {[""]}    <missing>     false  

    Create another variable configuration, for probing a voltage variable.

    VoltageConfig = simscape.probe.VariableConfiguration("V","Voltage","on")
    
    VoltageConfig = 
    
      VariableConfiguration with properties:
    
             Unit: V
        PortLabel: "Voltage"
          Probing: on 

    Add this variable configuration to the VariableTable object, assigning it to the variable v.

    table1 = insert(table1,"v",VoltageConfig)
    table1 = 
    
      VariableTable with 2 variable(s):
    
                 Unit     PortLabel    Probing
                ______    _________    _______
    
    
         w ⟼    {[""]}   <missing>     false  
         v ⟼    {[V]}    "Voltage"     true

    Input Arguments

    collapse all

    Variable table to modify, specified as a simscape.probe.VariableTable object.

    Block variable name to add to the probing table, specified as a character vector or string.

    Variable configuration, specified as a simscape.probe.VariableConfiguration object.

    Output Arguments

    collapse all

    Updated variable table, returned as a simscape.probe.VariableTable object.

    Version History

    Introduced in R2024b