%% Trace Generated Code to Blocks
% Navigate and trace between generated code and its source model for
% verification.

%% Open Example Model
% Open the example model |rtwdemo_hyperlinks|.
model='rtwdemo_hyperlinks';
open_system(model)
%% Code to Model Navigation
% Navigate from the generated code to the model.
%
% # In the Configuration Parameters
% dialog box, open the *Code Generation > Report* pane. 
% # Verify that the following parameters are selected: *Create code generation
% report*, *Open report automatically* and *Code-to-model*.
% # In the model editor window, press *Ctrl+B* to generate code. After the 
% code generation process is complete, the code generation report appears.
% # In the generated report, click the |rtwdemo_hyperlinks.c| link to see
% the code with embedded hyperlinks.
% # Click links in the code to trace generated code segments to the
% highlighted elements in the model. For example, if you click the
% hyperlink |&lt;Root&gt;/Sum|, the Sum block in the model is
% highlighted.
%
%% Model to Code Navigation
% Navigate from the model to the generated code.
%
% # In the Configuration Parameters
% dialog box, open the *Code Generation > Report* pane. 
% # Verify that the following parameters are selected: *Create code generation
% report*, *Open report automatically* and *Model-to-code*.
% # In the model editor window, press *Ctrl+B* to generate code. After the 
% code generation process is complete, the code generation report appears.
% # In the model window, right-click any block and select *C/C++ Code*
% > *Navigate To C/C++ Code*. The software highlights the generated code for this
% block in the code generation report.
% # Inspect the highlighted lines in the code generation report. The total
% number of highlighted lines is displayed next to each source file name in
% the left pane of the report. Use the *Previous* and *Next* buttons to
% navigate through the highlighted lines.
%
% Note: *Model-to-code* navigation also works for Stateflow objects and
% *MATLAB* functions.
%
% Note: The report displays a diagnostic message if there is no code to
% highlight for the selected block (for example, if you select a virtual
% block).
%% Traceability Report
% Generate and inspect the *Traceability Report*.
% 
% # In the Configuration Parameters
% dialog box, open the *Code Generation > Report* pane.
% # Verify that the following parameters are selected: *Create code generation
% report*, *Open report automatically* 
% # Search for the traceability report parameters using keyword 
% |GenerateTraceReport|. Verify all the listed parameters are selected.
% # In the model editor window, press *Ctrl+B* to generate code. After the 
% code generation process is complete, the code generation report appears.
% # To see a report of the untraceable (not in the generated code) and
% traceable blocks in your model, on the left pane of the generated report
% click *Traceability Report*.
% # In the *Traceability Report*, inspect the *Eliminated / Virtual Blocks*
% and *Traceable Blocks* lists. For example, the *Scope* block is an
% untraceable block. It is listed under *Eliminated / Virtual Blocks*
% because the code generator does not generate code for this block.
%
%   Copyright 2019 The MathWorks, Inc.
