Contents

Resolve Undefined Symbols in Your Chart

Search for Undefined Symbols

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.

For information about Simulink® symbol resolution, see Symbol Resolution and Symbol Resolution Process in the Simulink documentation.

Define Chart Symbols Using the Symbol Wizard

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.

Rules for Inferring the Scope of Unresolved Symbols

The Symbol Wizard follows these rules for inferring the scope of unresolved data symbols.

Unresolved Data SymbolInferred Scope
Written to and read from in the chartLocal
Read from but not written to in the chartInput
Written to but not read from in the chartOutput
Contains all capital letters in the name and is only read from but not written to in the chartParameter

The Symbol Wizard follows these rules for inferring the scope of unresolved event symbols.

Unresolved Event SymbolInferred Scope
Appears only in triggersInput
Appears only in send expressionsOutput
Appears in both triggers and send expressionsLocal

Inference of Size, Type, and Complexity

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 –1 (inherited).

  • Type is Inherit: Same as Simulink or Inherit: From definition in chart (for local data, and function inputs and outputs). For more information, see Type Stateflow Data.

  • Complexity is Inherited.

Was this topic helpful?