How can I change the build folder of a model?

I can use the fuction rtw.getBuildDir(..) to see the build information of the model. But is there a way to set/change these information? e.g. rtw.setBuildDir? Especially i want change the 'BuildDirectory' and the name of the Folder.

回答 (3 件)

Sebastian Castro
Sebastian Castro 2016 年 3 月 17 日

1 投票

You can do this using the Simulink preferences or the Simulink.fileGenControl function. Take a look at this blog:
- Sebastian

3 件のコメント

Ano Nym
Ano Nym 2016 年 3 月 17 日
Thanks a lot Sebastian
but I want to change the BuildDirectory. For instance "MyMode_ert_rtw" to "AnotherModelName" and not the CacheFolder or CodeGenFolder. Any ideas?
Dan Harris
Dan Harris 2018 年 3 月 6 日
Having the same issue, thanks!
Djordje
Djordje 2024 年 9 月 3 日
Having the same issue.

サインインしてコメントする。

William Katzianer
William Katzianer 2018 年 12 月 27 日
編集済み: William Katzianer 2018 年 12 月 27 日

1 投票

Simulink.fileGenControl has a nice help-file to do exactly what you wanted.
You need to first get the current configuration:
cfg = Simulink.fileGenControl('getConfig');
Then edit the data structure inside cfg to point to where you want the new build to be located at
For example:
cfg.CodeGenFolder = fullfile(pwd, '\SomeNewDirectory');
Then you'll need to set it using 'setConfig'
Simulink.fileGenControl('setConfig', 'config', cfg);
This worked for me to control where the build folders and cache folders need to go to.
EDIT: Doesn't look like you can actually change the folder name. What you could do I suppose is create a Directory name of your choosing and set that as where all of the simulink artifacts go.
Djordje
Djordje 2024 年 9 月 5 日

0 投票

I wanted to remove suffix (_grt_rtw).
Proceeded with following steps:
  1. Created custom .tlc file within my project -> copied existing one (C:\LegacyApp\Matlab2024a\rtw\c\grt\grt.tlc) into project repository, and renamed it (grt_custom.tlc).
  2. Added location of the new .tlc file to the MATLAB project path, so that it can be found.
  3. Updated model configuration, choosen the new one (grt_custom.tlc). If it is not visible as an option, it could be that file location is not within MATLAB path.
  4. Some configuration entries were changed, so I reverted them back.
  5. Uncommented line (it was commented out within the whole block): rtwgensettings.BuildDirSuffix = '_grt_rtw';
  6. In order to remove suffix, changed this line to: rtwgensettings.BuildDirSuffix = '';
Matlab version: R2024a

カテゴリ

ヘルプ センター および File Exchange で Deployment, Integration, and Supported Hardware についてさらに検索

質問済み:

2016 年 3 月 17 日

回答済み:

2024 年 9 月 5 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by