Using relative paths in function handles for Matlab compiler
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Wajahat Kazmi
am 12 Mär. 2017
Beantwortet: Chris Volpe
am 19 Apr. 2017
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 Kommentare
Geoff Hayes
am 13 Mär. 2017
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?
Akzeptierte Antwort
Weitere Antworten (2)
Steven Lord
am 13 Mär. 2017
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)
1 Kommentar
Chris Volpe
am 19 Apr. 2017
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 Kommentare
Siehe auch
Kategorien
Mehr zu Waveform Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!