To search for undefined symbol errors, you can use one of these methods:
Parse a chart by selecting Chart > Parse Chart.
Start simulation by selecting Simulation > Run in the model window.
Update the model diagram by selecting Simulation > Update Diagram in the model window.
For more information, see Parse Stateflow Charts.
The parser behaves differently depending how you set Parse custom code symbols on the Simulation Target > Custom Code pane in the Model Configuration Parameters dialog box.
For C charts, if you select the Parse custom code symbols check box, the parser tries to find unresolved chart symbols in the custom code. If the custom code does not define these symbols, they are flagged in the Symbol Wizard. The Symbol Wizard suggests scopes for unresolved data and event symbols. This option is not available for charts that use MATLAB® as the action language.
If you do not select the Parse custom code symbols check box, the parser considers unresolved data symbols in the chart to be defined in the custom code. If the custom code does not define these symbols, an error does not appear until make time.
Note: When you parse a chart with Chart > Parse Chart Stateflow® does have access to all required information for detecting unresolved symbols, such as enumerated data types and exported graphical functions from other charts. However, there can be false alarms from data types inherited from Simulink.
When you parse a chart, the Symbol Wizard flags unresolved symbols in your chart. The Symbol Wizard infers the class and scope of unresolved data and events.
If the inferred scope is incorrect for any events or data, you can change the scope in the Symbol Wizard. You can also change the class of a symbol between data and event.
To accept, reject, or change the scope of a recommended item, perform one of these steps:
To accept an item, select the check box in front of the item.
To reject an item, clear the check box.
To change the class or scope, select a different value from the drop-down list under Class or Scope.
After you edit the symbol definitions, click OK to add the symbols to the Stateflow hierarchy.
The Symbol Wizard follows these rules for inferring the scope of unresolved data symbols.
|Unresolved Data Symbol||Inferred Scope|
|Written to and read from in the chart||Local|
|Read from but not written to in the chart||Input|
|Written to but not read from in the chart||Output|
|Contains all capital letters in the name and is only read from but not written to in the chart||Parameter|
The Symbol Wizard follows these rules for inferring the scope of unresolved event symbols.
|Unresolved Event Symbol||Inferred Scope|
|Appears only in triggers||Input|
|Appears only in ||Output|
|Appears in both triggers and ||Local|
When the Symbol Wizard flags unresolved data in your chart that uses MATLAB as the action language, the following properties are inferred along with the scope:
Size is –
Same as Simulink or
Inherit: From definition
in chart (for local data, and function inputs and outputs).
For more information, see Type Stateflow Data.