Trace a block to generated code in code generation report
rtwtrace('
opens a code generation report
that displays contents of the source code file and highlights the line of code
corresponding to the specified block.blockpath
')
Before calling rtwtrace
, make sure that:
You select an ERT-based model and enable model to code navigation.
In the Configuration Parameters dialog box, select the Model-to-code parameter.
You generate code for the model by using the code generator.
Your build folder is under the current working folder. Otherwise, rtwtrace
might produce an error.
rtwtrace('
opens a code generation report that displays contents of the source code file
and highlights the line of code corresponding to the block identified by the
Simulink® identifier (SID). SID is a unique designation for each block or
element in the model. For more information, see Simulink Identifiers.Simulink_identifier
')
Display the generated code for block Out1
in the model
rtwdemo_comments
in code generation report:
% Using block path rtwtrace('rtwdemo_comments/Out1') % Using Simulink identifier rtwtrace('rtwdemo_comments:33')
To trace from a block in the model diagram, right-click a block and select C/C++ Code > Navigate to C/C++ Code.