Main Content

MATLAB 中的手动定点转换

辅助浮点算法转换为定点算法

使用 buildInstrumentedMex 函数来对算法进行插桩,以记录所有命名变量和中间变量的最小值和最大值。使用 showInstrumentationResults 函数根据这些记录的值建议定点数据类型。

函数

全部展开

buildInstrumentedMexGenerate compiled C code function including logging instrumentation
showInstrumentationResultsResults logged by instrumented, compiled C code function
clearInstrumentationResultsClear results logged by instrumented, compiled C code function
fi构造定点数值对象
fimath设置定点数学设置
numerictypeConstruct an embedded.numerictype object describing fixed-point or floating-point data type
eye创建具有定点属性的单位矩阵
ones用定点属性创建全一数组
zeros创建具有定点属性的全零数组
cast将变量转换为不同数据类型
cast64BitFiToIntCast fi object types that can be exactly represented to a 64-bit integer data type (自 R2020a 起)
cast64BitIntToFiCast 64-bit integer types to an equivalent fi object type (自 R2020a 起)
castFiToIntCast fi object to equivalent integer data type (自 R2020a 起)
castFiToMATLABCast fi object type to an equivalent built-in MATLAB data type (自 R2020a 起)
castIntToFiCast an integer data type to equivalent fi type (自 R2020a 起)

主题

疑难解答

Resolve Error: Function Is Not Supported for Fixed-Point Conversion

Troubleshoot functions that are not supported for fixed-point conversion.

解决错误:fi* 非 fi

fi*fi 错误故障排除。

解决错误:数据类型不匹配

对数据类型不匹配错误进行故障排除。

Resolve Error: Mismatched fimath

Troubleshoot mismatched fimath errors.

精选示例