How to change folder for "slprj" folder generation?

22 ビュー (過去 30 日間)
Sergei
Sergei 2025 年 11 月 6 日 10:52
コメント済み: Sergei 約3時間 前
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 件のコメント
Chuguang Pan
Chuguang Pan 約9時間 前
@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
Sergei 約7時間 前
@Chuguang Pan, Iam sorry for this. I overlooked something and thought the slprj is still created in the root project directory, but this actually works.
Thank you a lot for your explanations! Will you leave this solution as an answer so that I can mark it as best?

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

採用された回答

Chuguang Pan
Chuguang Pan 約12時間 前
@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"); % code generation folder in the pwd
mkdir("supply"); % simulink cache folder in the pwd
myProj.SimulinkCodeGenFolder = ".\codegen";
myProj.SimulinkCacheFolder = ".\supply";

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLarge-Scale Modeling についてさらに検索

製品


リリース

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by