I can't addpath on a compiled script

15 ビュー (過去 30 日間)
dyloni
dyloni 2018 年 7 月 9 日
回答済み: Walter Roberson 2018 年 7 月 9 日
I have tried to use the:
if ~isdeployed
addpath('pathname')
end
But this isn't working still once it's been compiled. I am working on a Linux machine if this helps.
If anyone can help it would be much appreciated.
Thanks
  1 件のコメント
Adam
Adam 2018 年 7 月 9 日
Can you deploy scripts? I thought it is only functions you can deploy.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 7 月 9 日
??
When something is compiled, isdeployed becomes true, and since you test ~ of that, the addpath() would not be called.
Compiled executables cannot change their path at runtime. You need to add the paths to the lists of places to look at compile time, or you need to use the -a option if you are using mcc, or you need to add the path before you compile; see https://www.mathworks.com/matlabcentral/answers/314624-how-to-use-addpath-in-compiled-matlab-code
If you are trying to use addpath to choose between different routines with the same name at run-time, then Don't Do That (TM).

カテゴリ

Help Center および File ExchangeStandalone Applications についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by