Matlab转换为C
自动匹配函数入口参数类型时,需要提前把测试函数跑一遍。
Matlab coder (2021a)生成C文件精简方法:
1.把设置中的Speed选项中Saturate on integer overflow 以及Support nonfinite numbers取消勾选。
2.在Code Appearance选项中把Generated file partitioning method设置为generate……into a single file这么做会将众多函数生成为一个文件。
3.在all settings中搜索example main函数选项,将值改为不生成main函数,即不生成测试函数。
**若需要给函数传递不定长的数组,就要把Memory选项的Dynamic memory allocation interface选项设置为Use C style EmxArray。double类型数组长度大概在7500左右。
除上述步骤,其他默认选项不用修改。