简体   繁体   English

如何使用“构建模型”功能从Matlab simulink块生成c / c ++代码?

[英]How can I generate c/c++ code from matlab simulink block using 'Build Model' function?

I have a controller block designed in Matlab R2013b simulink. 我在Matlab R2013b simulink中设计了一个控制器块。 I want to generate ac/c++ code of the block by using the 'Build Model' function. 我想通过使用“构建模型”功能生成该模块的ac / c ++代码。 However, I keep getting this error: 但是,我不断收到此错误:

"An installed compiler was not detected. Certain simulation modes, as well as host-based coder builds require that a compiler be installed. Please install one of the supported compilers for this release as listed at: http://www.mathworks.com/support/compilers/R2013b/win64.html MATLAB must be restarted after the compiler is installed ." “未检测到已安装的编译器。某些仿真模式以及基于主机的编码器版本要求安装编译器。请为此版本安装一种受支持的编译器,如以下所列: http : //www.mathworks.com /support/compilers/R2013b/win64.html安装编译器后,必须重新启动MATLAB 。”

I downloaded Microsoft Windows SDK for Windows 7 and .NET Framework 4 (supported and Compatible Compilers – Release 2013b). 我下载了适用于Windows 7和.NET Framework 4(受支持且兼容的编译器– 2013b版)的Microsoft Windows SDK。 However I am still getting the same error. 但是我仍然遇到相同的错误。

Please can anyone suggest a solution? 请谁能提出解决方案?

Step 1- download the Microsoft Windows SDK 7.1 from http://www.mathworks.co.uk/support/compilers/R2012a/win64.html . 步骤1-从http://www.mathworks.co.uk/support/compilers/R2012a/win64.html下载Microsoft Windows SDK 7.1。

Step 2 - Open the command line and type mex -setup 第2步-打开命令行并键入mex -setup

Step 3 - type y to locate installed compilers 步骤3-输入y以找到已安装的编译器

Step 4 - Type the number in front of the Microsoft Software Development Kit 7.1 (for me it was 1) 步骤4-在Microsoft Software Development Kit 7.1前面键入数字(对我来说是1)

Step 5 - type y to verify your choice 步骤5-输入y以确认您的选择

Step 6 - Open matlab and use the 'Build Function' to convert your simulink block to c/c++ code (For me it worked) 第6步-打开matlab并使用“构建函数”将simulink块转换为c / c ++代码(对我而言,它起作用了)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM