Main Content

Enable Plotting Using the Simulation Data Inspector

You can use the Simulation Data Inspector (Simulink) to inspect and compare floating-point and fixed-point input and output data logged using the codegen function. At the MATLAB® command line:

  1. Create a fixed-point configuration object and configure the test file name.

    fixptcfg = coder.config('fixpt');
    fixptcfg.TestBenchName = 'dti_test';
    

  2. Select to run the test file to verify the generated fixed-point MATLAB code. Log inputs and outputs for comparison plotting and select to use the Simulation Data Inspector to plot the results.

    fixptcfg.TestNumerics = true;
    fixptcfg.LogIOForComparisonPlotting = true;
    fixptcfg.PlotWithSimulationDataInspector = true;
  3. Generate fixed-point MATLAB code using codegen.

    codegen -float2fixed fixptcfg -config cfg dti

For an example, see Propose Fixed-Point Data Types Based on Derived Ranges.