Using relative paths in function handles for Matlab compiler
2 ビュー (過去 30 日間)
古いコメントを表示
Hi I am generating a deployable exe using Matlab Compiler (mcc). My code includes certain function handles whose files, in the target PCs, will be at different locations than the PC they were generated on. Matlab compiler generates an exe, successfully. However, it looks for the absolute paths of the files for the corresponding function handles.
I would be grateful, if someone can tell me:
1- How can I use relative paths in the function handles (since the .m files for the functions will be at a fixed relative location w.r.t the exe file but different absolute location on the target PCs)?
2- If I cannot, what is the best possible work around?
Best Regards Wajahat
2 件のコメント
Geoff Hayes
2017 年 3 月 13 日
Wajahat - are these files chosen by the user through the GUI or do you really mean the m-files which would be packaged with the executable?
採用された回答
その他の回答 (2 件)
Steven Lord
2017 年 3 月 13 日
How are you creating these function handles? If the functions are on the MATLAB search path, neither you nor your program should care where the actual files are located. For instance, the vander function is on the MATLAB path and so this code doesn't care in which directory the actual vander.m is stored.
F = @vander;
F(1:5)
Chris Volpe
2017 年 4 月 19 日
Try adding:
%#function myfunc
to your code. This comment serves as a hint to the compiler that it should include the specified function in the compiled functions package even if it is not reached during dependency checking.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Waveform Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!