Documentation

convertToSingle

Convert a double-precision system to single precision

Syntax

ConversionReport = DataTypeWorkflow.Single.convertToSingle(systemToConvert)

Description

ConversionReport = DataTypeWorkflow.Single.convertToSingle(systemToConvert) converts the system specified by systemToConvert to single precision and returns a report. Data types that are specified as Boolean, fixed point, or one of the built-in integers are not affected by conversion.

Input Arguments

expand all

The system to convert from double-precision to single-precision, specified as a character vector. The system must be open before using this method.

Data Types: char

Output Arguments

expand all

Report containing results from the conversion.

Examples

expand all

  1. Open the system to convert to single precision.

    addpath(fullfile(docroot,'toolbox','fixpoint','examples'))
    ex_fuel_rate_calculation

  2. Use the DataTypeWorkflow.Single.convertToSingle method to convert the system from double precision to single precision.

    report = DataTypeWorkflow.Single.convertToSingle('ex_fuel_rate_calculation')
    The specified system now uses single-precision data types instead of double-precision data types. Data types in the model that were specified as Boolean, fixed-point, or one of the built-in integers remain the same after conversion.

Alternatives

You can also use the Single Precision Converter app to convert a system from double precision to single precision. To open the Converter, from the Simulink® Analysis menu, select Data Type Design > Single Precision Converter. For more information, see Getting Started with Single Precision Converter.

Introduced in R2016b

Was this topic helpful?