Traceability of State Transition Tables

This example shows how to navigate bidirectionally between objects in your state transition table and the generated C/C++ and HDL code for traceability.

  1. At the MATLAB® prompt, type sf_cdplayer_STTsf_cdplayer_STT. This model is already configured for traceability. For more information on these configurations, see Traceability of Stateflow Objects in Generated Code.

  2. Open the Model Configuration Parameters dialog box.

  3. In the Code Generation pane, click Generate Code in the lower-right corner.

    This step generates source code and header files for the sf_cdplayer_STT model. After the code generation process is complete, the code generation report appears automatically.

  4. Click the sf_cdplayer_STT.c hyperlink in the report.

  5. Scroll down through the code to see the traceability comments. The line numbers shown can differ from the numbers that appear in your code generation report.

  6. Click the <S2>:58 hyperlink in this traceability comment:

    /* Entry Internal 'ON': '<S2>:58' */

    The corresponding state'ON' appears highlighted in the state transition table.

  7. Right-click the highlighted state and select View state object. The state 'ON' also appears highlighted in the underlying state transition diagram.

  8. You can also trace a state or transition from the state transition table to the generated code. Right click on the state Standby and select C/C++ Code > Navigate to C/C++ Code.

    The entry code for the state Standby is highlighted in the generated code.

Was this topic helpful?