View and Modify Variable Information

View Variable Information

On the Convert to Fixed Point page of the MATLAB® Coder™ app, you can view information about the variables in the MATLAB functions. To view information about the variables for the function that you selected in the Source Code pane, use the Variables tab or pause over a variable in the code window. For more information, see Viewing Variables.

You can view the variable information:

  • Variable

    Variable name. Variables are classified and sorted as inputs, outputs, persistent, or local variables.

  • Type

    The original size, type, and complexity of each variable.

  • Sim Min

    The minimum value assigned to the variable during simulation.

  • Sim Max

    The maximum value assigned to the variable during simulation.

To search for a variable in the MATLAB code window and on the Variables tab, use Ctrl+F.

Modify Variable Information

If you modify variable information, the app highlights the modified values using bold text. You can modify the following fields:

  • Static Min

    You can enter a value for Static Min into the field or promote Sim Min information. See Promote Sim Min and Sim Max Values.

    Editing this field does not trigger static range analysis, but the app uses the edited values in subsequent analyses.

  • Static Max

    You can enter a value for Static Max into the field or promote Sim Max information. See Promote Sim Min and Sim Max Values.

    Editing this field does not trigger static range analysis, but the app uses the edited values in subsequent analyses.

  • Whole Number

    The app uses simulation data to determine whether the values assigned to a variable during simulation were always integers. You can manually override this field.

    Editing this field does not trigger static range analysis, but the app uses the edited value in subsequent analyses.

  • Proposed Type

    You can modify the signedness, word length, and fraction length settings individually:

    • On the Variables tab, modify the value in the ProposedType field.

    • In the code window, select a variable, and then modify the Proposed Type field.

    If you selected to log data for a histogram, the histogram dynamically updates to reflect the modifications to the proposed type. You can also modify the proposed type in the histogram, see Log Data for Histogram.

Revert Changes

  • To clear results and revert edited values, right-click the Variables tab and select Reset entire table.

  • To revert the type of a selected variable to the type computed by the app, right-click the field and select Undo changes.

  • To revert changes to variables, right-click the field and select Undo changes for all variables.

  • To clear a static range value, right-click an edited field and select Clear this static range.

  • To clear manually entered static range values, right-click anywhere on the Variables tab and select Clear all manually entered static ranges.

Promote Sim Min and Sim Max Values

With the MATLAB Coder app, you can promote simulation minimum and maximum values to static minimum and maximum values. This capability is useful if you have not specified static ranges and you have simulated the model with inputs that cover the full intended operating range.

To copy:

  • A simulation range for a selected variable, select a variable, right-click, and then select Copy sim range.

  • Simulation ranges for top-level inputs, right-click the Static Min or Static Max column, and then select Copy sim ranges for all top-level inputs.

  • Simulation ranges for persistent variables, right-click the Static Min or Static Max column, and then select Copy sim ranges for all persistent variables.