MATLAB 帮助中心
为定点或单精度转换创建配置对象
config_obj = coder.config('fixpt')
config_obj = coder.config('single')
config_obj = coder.config('fixpt') 创建一个 coder.FixptConfig 配置对象。在将浮点 MATLAB® 代码转换为定点 MATLAB 代码时,请将此对象与 fiaccel 函数结合使用。
coder.FixptConfig
fiaccel
示例
config_obj = coder.config('single') 创建一个 coder.SingleConfig 配置对象,以便在从双精度 MATLAB 代码生成单精度 MATLAB 代码时与 convertToSingle 函数结合使用。
coder.SingleConfig
convertToSingle
全部折叠
使用默认设置创建一个 coder.FixptConfig 对象 fixptcfg。
fixptcfg
fixptcfg = coder.config('fixpt');
设置测试平台名称。在此示例中,测试平台函数名称为 dti_test。
dti_test
fixptcfg.TestBenchName = 'dti_test';
将浮点 MATLAB 函数转换为定点 MATLAB 代码。在此示例中,MATLAB 函数名称为 dti。
dti
fiaccel -float2fixed fixptcfg dti
创建一个 coder.SingleConfig 对象 scfg。
scfg
scfg = coder.config('single');
设置测试平台名称。在此示例中,测试平台函数名称为 myfun_test。为输入和输出变量的比较绘图启用数值测试和数据记录。
myfun_test
scfg.TestBenchName = 'myfun_test'; scfg.TestNumerics = true; scfg.LogIOForComparisonPlotting = true;
将双精度 MATLAB 代码转换为单精度 MATLAB 代码。在此示例中,MATLAB 函数名称是 myfun。
myfun
convertToSingle -config scfg myfun
在 R2014b 中推出
coder.FixPtConfig | fiaccel | coder.SingleConfig | convertToSingle
coder.FixPtConfig
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处