How to specify relative code paths in S-function builder

10 ビュー (過去 30 日間)
Brandon 2023 年 8 月 4 日
編集済み: Hua Bai 2023 年 10 月 19 日
When setting INC_PATH, etc. in the S-function builder, how do I specify that path relative to some path (preferably from the directory in which the model is stored).
Use case: The simulink model exists in a git repo that is clone by multiple users. The code in the S-function builder block depends on a fair bit of C code that is also in that repo (and hence at a known location relative to the model slx file). Forcing each user to go in and edit full paths for their machine is annoying to say the least.

回答 (1 件)

Les Beckham
Les Beckham 2023 年 8 月 7 日
  2 件のコメント
Brandon 2023 年 8 月 7 日
That doesn't work. Seems like very little documentation on the use of ENV_PATH. Those dialogs don't seem to be picking up any environment variables. Also tried just setting ENV_PATH to the project root directly, but that did not work either.
Hua Bai
Hua Bai 2023 年 10 月 19 日
編集済み: Hua Bai 2023 年 10 月 19 日
Hi Brandon, did you set the environment variable before you use it?
For your example, I guess you missed the step of "setenv("PROJROOT", "path to your project root");".
One example which works on my side is attached, you need to run the following line in matlab command window before you build your s-function builder.
setenv("myProjPath", "path to the folder");



Help Center および File ExchangeTarget Computer Setup についてさらに検索




Community Treasure Hunt

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

Start Hunting!

Translated by