Main Content

Troubleshoot Navigation from Code to Model

When you run Polyspace® on generated code, in the analysis results, you see links in code comments. The links show names of blocks that generate the subsequent lines of code. To see the blocks in the model, you click the block names in the links.

Flow diagram showing navigation from model to code. If you navigate from a code element back to the model, the relevant block from which the code is generated appears highlighted.

This topic shows the issues that can happen in navigation from code to model.

Links from Code to Model Do Not Appear

See if you are looking at source files (.c or .cpp) or header files. Header files are not directly associated with blocks in the model and do not have links back to the model.

Links from Code to Model Do Not Work

You may encounter issues with the back-to-model feature if:

  • Your operating system is Windows Vista® or Windows® 7; and User Account Control (UAC) is enabled or you do not have administrator privileges.

  • You have multiple versions of MATLAB® installed.

To reconnect MATLAB and Polyspace:

  1. Close Polyspace.

  2. At the MATLAB command-line, enter pslinkfun('enablebacktomodel').

    When you open your Polyspace results, the hyperlinks will highlight the relevant blocks in your model.

Your Model Already Uses Highlighting

If your model extensively uses block coloring, the coloring from this feature may interfere with the colors already in your model. You can change the color of blocks when they are linked to Polyspace results. For instance, to change the color to magenta, use this command:

color = 'magenta';
HILITE_DATA = struct('HiliteType', 'find', 'ForegroundColor', 'black', ...
        'BackgroundColor', color);
set_param(0, 'HiliteAncestorsData', HILITE_DATA)
The color can be one of the following:

  • 'cyan'

  • 'magenta'

  • 'orange'

  • 'lightBlue'

  • 'red'

  • 'green'

  • 'blue'

  • 'darkGreen'