Symbol
Description
Symbol
objects represent symbols in condition expressions in
conditionals. You can modify the conditional by setting the object properties.
Creation
To create a Symbol
object, use the getSymbols
function on a specified Conditional
object.
Properties
Name
— Name of symbol
string scalar | character vector
Name of the symbol, specified as a string scalar or character vector.
Data Types: char
| string
Type
— Type of symbol
"Expression"
(default) | "Model Element"
Type of symbol, specified as either
"Expression"
or "Model
Element"
. Use this property to specify how the symbol
retrieves values from the model. If you set Type
to "Expression"
, the symbol uses the values
evaluated from a specified expression. If you set
Type
to "Model Element"
, the
symbol uses the values evaluated from a specified model
element.
Data Types: enumeration
Expression
— Expression that symbol is mapped to
''
(default) | string scalar | character vector
Expression that the symbol is mapped to, specified as a string scalar or character
vector. This property appears only if the Type
property is
"Expression"
.
Example: symbol.Expression = "1"
sets the symbol expression to
1
.
Data Types: char
| string
Path
— Path of model element
''
(default) | string scalar | character vector
Path of the model element to which the symbol is assigned, specified as a string
scalar or character vector. This property appears only if the Type
property is "Model Element"
.
Example: symbol.path =
"SimpleMotorArmatureWindingFault/DC Motor/Armature winding
assigns the
symbol to the armature winding of the DC Motor
block.
Data Types: char
| string
Examples
Retrieve the Symbols in a Conditional Expression
Open a model with a block that supports fault modeling.
openExample('simscape_shared/SimpleMotorArmatureWindingFaultExample')
Add a conditional named myConditional
to the model, and specify
the condition expression as y1+y2 >= 0
.
faultConditional = Simulink.fault.addConditional(... "SimpleMotorArmatureWindingFault","myConditional","y1+y2 >= 0");
Retrieve the symbols defined in the expression.
mySymbols = getSymbols(faultConditional)
mySymbols = 1×2 Symbol array with properties: Type Expression Path Name
Version History
Introduced in R2023b
See Also
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 (한국어)