This example shows how to navigate bidirectionally between objects in your state transition table and the generated C/C++ and HDL code for traceability.
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.
Open the Model Configuration Parameters dialog box.
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.
Click the sf_cdplayer_STT.c hyperlink in the report.
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.
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.
Right-click the highlighted state and select View state object. The state 'ON' also appears highlighted in the underlying state transition diagram.
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.