Is there an option to disable "startup.m" from being compiled into my code?

15 views (last 30 days)
There are "addpath" and "cd" commands in my "startup.m" file. When I compile code for deployment and run the program on the deployed machine, these lines cause errors. However, it works as expected on the development machine.
I do not want the application compiler ("deploytool") or "mcc" to compile "startup.m" into my application, so I would like the option not to have it compiled into the final code if possible.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 26 Jul 2022
Edited: MathWorks Support Team on 28 Sep 2022
"startup.m" is compiled into the deployed program to ensure that the deployed application code behaves the same as the code in the MATLAB environment.
There is currently no compiler option to disable this feature. However, the "isdeployed" function can be used as a workaround within the "startup.m" file.
For example:
if ~isdeployed
  % startup code. Including specify 
  % computer specific settings
end

More Answers (0)

Categories

Find more on Standalone Applications in Help Center and File Exchange

Products


Release

R2013b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!