网站大量收购独家精品文档,联系QQ:2885784924

MATLAB 生成C 语言.pdf

  1. 1、本文档共10页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
MATLAB 生成C 语言

技术翻译资料 编号:TCEC-2014-06-29 MATLAB C 生成 语言 平均值滤波器 AveragingFilter ThisexampleshowstherecommendedworkflowforgeneratingCcodefroma MATLABfunctionusingthecodegencommand.Thesearethesteps:1.Addthe %#codegendirectivetotheMATLABfunctiontoindicatethatitisintendedforcode generation.ThisdirectivealsoenablestheMATLABcodeanalyzertoidentify warningsanderrorsspecifi toMATLABforcodegeneration. MATLAB ‘codegen’ C 该例子展示从 的功能块中采 命令生成 代码的工作流 程。 1、 采 %#codegen来知道MATLAB 的功能块指出这是为代码生成的。这个指 意符还会使MATLAB去分析代码并生成警告及错误信息。 2. Generate a MEX function to check that the MATLAB code is suitable for code generation. Iferrorsoccur,youshouldfixthe beforegeneratingCcode. 生成MEX功能块,并分析生成的功能块是否能够生成C代码,若有错误,压在 生成C代码前纠正这些错误。 3. Test the MEX function in MATLAB to ensure that it is functionally equivalent to the originalMATLABcodeandthat norun-timeerrorsoccur. 测试这个功能块,并保证和原MATLAB 中的功能是相同的,在运行期间不发生 错误。 4.GenerateCcode. 生成C 代码 5. Inspectthe Ccode. C 检查 代码 Prerequisites Therearenoprerequisitesforthisexample. CreateaNewFolderandCopyRelevantFiles Thefollowingcodewillcreateafolder inyourcurrentworkingfolder (pwd).The newfolder willonlycontainthefilesthatare relevantforthisexample. Ifyou do notwanttoaffectthe current folder (or if you cannot generate files in this folder), you should change your workingfolder. 下面的代码可以在工作目录下生成一个目录。新目录中只包含与例子相关的文 技术翻译资料 编号:TCEC-2014-06-29 件。若你不想生成一个新文件夹或你无法在当前文件夹下生成目录,你需要更改 路径。 RunCommand:CreateaNewFolderandCopyRelevantFiles coderdemo_setup(coderdemo_averaging_filter); 运行上述命令,来建立一个新的目录并复制相关的文件。 Abouttheaveraging_filterFunction The averaging_filter. function acts as an averaging filter on the inputsignal; ittakes an inputvector of values and computes an averagefor eachvalue inthe

文档评论(0)

yan698698 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档