Using relative paths in function handles for Matlab compiler
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Wajahat Kazmi
el 12 de Mzo. de 2017
Respondida: Chris Volpe
el 19 de Abr. de 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 comentarios
Geoff Hayes
el 13 de Mzo. de 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?
Respuesta aceptada
Más respuestas (2)
Steven Lord
el 13 de Mzo. de 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 comentario
Chris Volpe
el 19 de Abr. de 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 comentarios
Ver también
Categorías
Más información sobre Waveform Generation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!