This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Resolve Undefined Symbols in Your Chart

Search for Undefined Symbols

To search for undefined symbol errors, use one of these methods:

  • View the Symbols window and look for a red error icon . When you hover your cursor over the icon, you see Undefined symbol.

  • 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.

The parser behaves differently depending on how you set Parse custom code symbols in the Model Configuration Parameters dialog box, on the Simulation Target pane.

  • 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, Stateflow® has 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 (Simulink) and Symbol Resolution Process (Simulink).

Resolve Undefined Data in the Symbols Window

When you edit charts, Stateflow detects symbols in your chart that you have not added as data, events, or messages. Undefined symbols are displayed in the Symbols window with a red error icon . When you select the error icon and choose Fix, Stateflow defines the symbol and infers a scope, type, size, and complexity. To resolve all the undefined symbols detected in the Symbols window, select the Resolve undefined symbols button,

Define Chart Symbols with 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

Stateflow 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

Stateflow 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 Stateflow 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).

  • Complexity is Inherited.

Related Topics

Was this topic helpful?