How to change folder for "slprj" folder generation?
Mostrar comentarios más antiguos
Dear all,
I have read the following question https://www.mathworks.com/matlabcentral/answers/535769-how-can-i-change-the-location-where-generated-simulink-files-are-placed about where the "slprj" folder is created during model update and code generation.
In the Simulink preferences we can see that the parent folder changes to the current folder each time we change the working directory (so by the simulink the parent folder is always locked to "pwd").
I wanted to change the folder for "slprj" from "pwd" to "pwd/supply" in the way that each time I change the working directory the folder for "slprj" changes also the way it does by default with "pwd".
Is there a way to do so? Using startup.m for example.
Thank you!
6 comentarios
Chuguang Pan
el 6 de Nov. de 2025
I usually use MATLAB Project to organize the MATLAB/SImulink files. If your simulink model is included in the project, you can configure the simulink code generation folder by setting the project's SimulinkCodeGenFolder property.
myProj = currentProj;
myProj.SimulinkCodeGenFolder = "your code generation folder path";
Chuguang Pan
el 6 de Nov. de 2025
@Sergei. The SimulinkCodeGenFolder included in the project is a relative folder, it depends on the RootFolder of project. I have tested this using R2025a, and find that when I move the RootFolder of the project, the path of SimulinkCodeGenFolder is also updated.
Chuguang Pan
el 7 de Nov. de 2025
@Sergei. For setting up the path of "slprj" folder, you have to configure the SimulinkCacheFolder of project. For instance,
myProj = openProject("your project");
mkdir("codegen");
mkdir("caches");
myProj.SimulinkCodeGenFolder = ".\codegen";
myProj.SimulinkCacheFolder = ".\caches";
Sergei
el 7 de Nov. de 2025
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Schedule Model Components en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!