How can I change the build folder of a model?

89 visualizzazioni (ultimi 30 giorni)
Ano Nym
Ano Nym il 17 Mar 2016
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.

Risposte (2)

Sebastian Castro
Sebastian Castro il 17 Mar 2016
You can do this using the Simulink preferences or the Simulink.fileGenControl function. Take a look at this blog:
- Sebastian
  2 Commenti
Ano Nym
Ano Nym il 17 Mar 2016
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 il 6 Mar 2018
Having the same issue, thanks!

Accedi per commentare.


William Katzianer
William Katzianer il 27 Dic 2018
Modificato: William Katzianer il 27 Dic 2018
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.

Community Treasure Hunt

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

Start Hunting!

Translated by