Documentation

coder.config

Create configuration object for fixed-point or single-precision conversion

Syntax

config_obj = coder.config('fixpt')
config_obj = coder.config('single')

Description

example

config_obj = coder.config('fixpt') creates a coder.FixptConfig configuration object. Use this object with the fiaccel function when converting floating-point MATLAB® code to fixed-point MATLAB code.

example

config_obj = coder.config('single') creates a coder.SingleConfig configuration object for use with the convertToSingle function when generating single-precision MATLAB code from double-precision MATLAB code.

Examples

collapse all

Create a coder.FixptConfig object, fixptcfg, with default settings.

fixptcfg = coder.config('fixpt');

Set the test bench name. In this example, the test bench function name is dti_test.

fixptcfg.TestBenchName = 'dti_test';

Convert your floating-point MATLAB design to fixed point. In this example, the MATLAB function name is dti.

fiaccel -float2fixed fixptcfg dti

Create a coder.SingleConfig object, scfg.

scfg = coder.config('single');

Set the test bench name. In this example, the test bench function name is myfun_test. Enable numerics testing and data logging for comparison plotting of input and output variables.

scfg.TestBenchName = 'myfun_test';
scfg.TestNumerics = true;
scfg.LogIOForComparisonPlotting = true;

Convert the double-precision MATLAB code to single-precision MATLAB code. In this example, the MATLAB function name is myfun.

convertToSingle -config scfg myfun

Introduced in R2014b

Was this topic helpful?