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 =
"fault_analyzer_intro/Constant/Outport/1"
assigns the symbol to the output
signal of the first port of the Constant block in the
fault_analyzer_intro
model.
Data Types: char
| string
Examples
Retrieve the Symbols in a Conditional Expression
Open the fault_analyzer_intro
model.
openExample('faultanalyzer/FaultAnalyzerIntroExample')
Add a conditional named myConditional
with the condition
expression y1+y2 >= 0
.
faultConditional = Simulink.fault.addConditional(... "fault_analyzer_intro","myConditional","y1+y2 >= 0");
Retrieve the symbols defined in the expression.
mySymbols = getSymbol(faultConditional);
Version History
Introduced in R2023b
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
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)