Best practice for adding program path for programs intended for compiling
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
My software for data analysis has grown to a fairly big size, and is split to several subdirectories,
like /MATLAB/Myprogram, /MATLAB/Myprogram/GUI
and some others. Normally, I just list the paths to startup.m,
path(path,'/MATLAB/Myprogram')
path(path,'/MATLAB/Myprogram/GUI')
and so on. This works fine, but when I compile the software (to be used with MRE), a bunch of warnings are created,
as this is considered bad programming practice for programs intended for compiling (I agree with that). However, the problem is that I HAVE NOT FOUND AN OBVIOUS ALTERNATIVE WAY of telling MATLAB where to find the functions and classes!
What would that be?
0 commentaires
Réponses (1)
Rishav
le 17 Avr 2024
Hi Mikael,
I understand that you want to know the best practice to add the program path for programs intended for compilation.
Instead of dynamically adding paths at runtime, you can set up your paths statically before compilation. You can do this by organizing your code as suggested above and then using the 'mcc' command (MATLAB Compiler Command) with the '-a' option to explicitly add any additional files or folders that are not automatically included due to direct referencing in your code. For example:
mcc -m MyMainScript.m -a /path/to/additional/files
This tells the compiler explicitly about additional files or directories to include in the compilation.
You can also refer to the below mentioned documentation on mcc Comand Line Arguments:
0 commentaires
Voir également
Catégories
En savoir plus sur Standalone Applications dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!