Azzera filtri
Azzera filtri

Best practice for adding program path for programs intended for compiling

4 visualizzazioni (ultimi 30 giorni)
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,
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?

Risposte (1)

Rishav il 17 Apr 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:


Scopri di più su MATLAB Compiler 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!

Translated by