将生成的代码保存在"rtwbuild"目录中的特殊文件夹中. [英] Save generated code in a special folder in "rtwbuild"

查看:163
本文介绍了将生成的代码保存在"rtwbuild"目录中的特殊文件夹中.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用rtwbuild从Simulation图生成C ++代码,并想将生成的代码保存到任意目录中.有什么办法吗?

I am using rtwbuild to generated C++ code from a Simulation diagrams and would like to save generated code to an arbitrary directory. Is there any way to do so?

推荐答案

您可以通过3种不同的方式控制生成文件的文件夹.您可以在Simulink首选项中设置代码生成文件夹"选项.您可以使用文件"菜单从任何模型访问Simulink首选项,然后选择Simulink首选项.这将更改所有模型的代码生成位置,并将在整个MATLAB会话中持续存在.

You can control the folder for generated files in 3 different ways. You can set the "Code generation folder" option in Simulink Preferences. You can reach to Simulink preferences from any model using File menu and then choosing Simulink Preferences. This will change the code generation location for all models and will persist across MATLAB sesstions.

第二,您可以在MATLAB中设置全局参数,该参数将再次控制所有模型的代码生成目录,但仅在该MATLAB会话中持久存在.例如,

Second you can set a global param in MATLAB which will again control code generation directory for all models but will persist only for that MATLAB session. For example,

set_param(0, 'CodegenFolder', fullfile('C:','Work','mymodelrtw'))
get_param(0, 'CodegenFolder')

您还可以使用Simulink.fileGenControl对象来设置codegen文件夹,就像上面的会话参数一样.该对象对保留先前的文件夹路径以及可选地创建文件夹具有更多控制权.

You can also use Simulink.fileGenControl object to set the codegen folder like the session param above. This object has more control about retaining previous folder paths and creating the folder optionally.

请参见 http://www.mathworks.com/help/rtw/ug/control-the-location-for-generation-files.html

这篇关于将生成的代码保存在"rtwbuild"目录中的特殊文件夹中.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆