keys
Syntax
Description
returns the block variable names for the variable table object,
k
= keys(variableTable
)variableTable
.
Examples
Create Variable Table and Return Variable Names
Create a variable table and save it as a workspace variable by entering:
table1 = simscape.instrumentation.VariableTable
table1 = VariableTable with unset variable(s)
Suppose you have a Simscape block with the variable
C.w
. To configure the variable for logging, make a variable configuration to store the selective logging settings. Make a variable configuration for the variableC.w
by entering:table1("C.w") = simscape.instrumentation.VariableConfiguration
table = VariableTable (string ⟼ VariableConfiguration) with 1 variable(s): Name Unit Logging _________ ____ _______ C.w ⟼ <missing> "" false
Use the
insert
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
Return the block variables for
table1
.varNames = keys(table1)
varNames = 2×1 string array "C.w" "R.w"
Input Arguments
variableTable
— Variable table object
simscape.instrumentation.VariableTable
object
Variable table, specified as a
simscape.instrumentation.VariableTable
object.
Output Arguments
k
— Variable names
string array
Variable names for the elements in the variable table, returned as a string array.
Version History
Introduced in R2024a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)