MATLAB: Where can I place a configuration file for a MATLAB-compiled Application

additionalattachcompilerconfigfilefilesincludeMATLABMATLAB Compiler

Best Answer

Given that this configuration file will need to be modified by the end users of the application, we cannot put it in the deployable archive (CTF). If placed in the CTF, then it will not allow the end user to modify the file. There are two ways to achieve this (via mcc and applicationCompiler):
1) Via applicationCompiler:
In this case, you can add the configuration file within the "Files installed for your end user" section. This will have the installer install the file alongside with the executable itself (without including it in the CTF).
Depending on how you are referencing the configuration file in the call to load, you may want to add %#exclude to make sure the file is not included in the CTF. For example:
- If you are calling "load foo" or "load foo.mat" it will get included in the CTF without the %#exclude. So in this case, you should add the %#exclude
- However, if you are calling "load ./foo.mat", you would not need to add the %#exclude
2) Via mcc:
Since we currently (as of R2020a) do not have a way of including such files via mcc, you will need to distribute the file along with the application executable. Please note, that the same rules apply here for mcc regarding %#exclude which are mentioned above.
You can refer to the following documentation for more information on %#exclude: