Best practice for adding program path for programs intended for compiling
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Rishav
2024-4-17
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Standalone Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!