Resolve Undefined Symbols in Your Chart

Symbols that appear in your chart but that you have not added as data, events, or messages are undefined or unresolved. You can resolve undefined symbols by using the Symbols window or the Symbol Wizard. For each undefined symbol, based on the symbol usage in the chart, Stateflow® infers these properties:

  • Class (data, event, or message)

  • Scope

  • Size

  • Type

  • Complexity

Resolve Symbols Through the Symbols Window

As you edit your chart, Stateflow detects undefined symbols and marks them in the Symbols window with a red error icon . For each undefined symbol, the TYPE column displays the class and scope inferred from the usage in the chart. You can resolve undefined symbols individually or collectively.

  • To define a symbol with the inferred class and scope, click the error icon and select Fix.

  • To define a symbol with a different class or scope, select another combination of class and scope from the TYPE drop-down list.

  • To resolve all of the undefined symbols with their inferred classes and scopes, click the Resolve undefined symbols button .

Resolve Symbols Through the Symbol Wizard

If Stateflow detects any undefined symbols when you parse a chart, update a diagram, or simulate a model, the Symbol Wizard opens and lists the undefined symbols. For each undefined symbol, the Class and Scope columns display the class and scope inferred from the usage in the chart. You can accept, modify, or reject each symbol definition that the Symbol Wizard suggests.

  • To accept a definition with the inferred class and scope, select the check box in front of the symbol.

  • To modify a definition, select a different class or scope from the Class or Scope drop-down lists.

  • To reject a definition, clear the check box in front of the symbol.

After you edit the symbol definitions, add the symbols to the Stateflow hierarchy by clicking OK.

Detect Symbol Definitions in Custom Code

Detection of symbols defined in custom code depends on the model configuration parameter Import custom code.

  • If you select Import custom code, the parser tries to find unresolved chart symbols in the custom code. If the custom code does not define these symbols, they appear in the Symbol Wizard.

  • If you do not select Import custom code, the parser considers unresolved data symbols in the chart as defined in the custom code. If the custom code does not define these symbols, simulating and generating code from the model results in an error.

The Import custom code option is not available for charts that use MATLAB® as the action language. For more information, see Import custom code (Simulink).

Related Topics