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

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

问题描述

我正在使用 rtwbuild 从模拟图中生成 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 Preferences 中设置代码生成文件夹"选项.您可以使用 File 菜单从任何模型访问 Simulink 首选项,然后选择 Simulink Preferences.这将更改所有模型的代码生成位置,并将在 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-generated-files.html

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

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