Using relative paths in function handles for Matlab compiler
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Wajahat Kazmi
il 12 Mar 2017
Risposto: Chris Volpe
il 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 Commenti
Geoff Hayes
il 13 Mar 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?
Risposta accettata
Più risposte (2)
Steven Lord
il 13 Mar 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 Commento
Chris Volpe
il 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 Commenti
Vedere anche
Categorie
Scopri di più su Waveform Generation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!