Main Content

insert

Insert key and value into variable table object

Since R2024a

    Description

    newVariableTable = insert(variableTable,key,value) inserts the key, key, and the value, value, into the variable table object, variableTable and returns the variable table object newVariableTable.

    example

    Examples

    collapse all

    1. Create a variable table and save it as a workspace variable by entering:

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

    2. Suppose you have a Simscape block with the variables C.w and R.w. Add the variables to table1 by entering:

      table1 = insert(table1,"C.w",simscape.instrumentation.VariableConfiguration);
      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 
      

    Input Arguments

    collapse all

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

    Block variable names to add to the variable table object, specified as a character vector or string.

    Variable configuration, returned as an array of simscape.instrumentation.VariableConfiguration objects.

    Output Arguments

    collapse all

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

    Version History

    Introduced in R2024a