Main Content

convertToSingle

Convert a double-precision system to single precision

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.

example

Examples

collapse all

This example shows how to convert a double-precision system to single precision.

Open the system to convert to single precision.

open_system('ex_fuel_rate_calculation');

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

report = DataTypeWorkflow.Single.convertToSingle('ex_fuel_rate_calculation');
Updating Model Advisor cache...
Model Advisor cache updated. For new customizations, to update the cache, use the Advisor.Manager.refresh_customizations method.

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.

Input Arguments

collapse 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

collapse all

Report containing results from the conversion.

Alternatives

You can also use the Single Precision Converter app to convert a system from double precision to single precision. To open the Single Precision Converter app, in the Simulink® Apps tab, select Single Precision Converter. For more information, see Getting Started with Single Precision Converter.

Version History

Introduced in R2016b