MATLAB: Doesn’t the startup.m file work

MATLAB

Why doesn't my startup.m file work?
I am having an issue where my "startup.m" file is not executing. I need it to set up the path for a particular script to run. I launch MATLAB and execute that script from a different program, so without "startup.m" I get the error " [Script/Function] is not found in the current folder or on the MATLAB path, but exists in: [Some other directory]".

Best Answer

Is your "startup.m" file located at your userpath? If it is located somewhere else, you may not get the behavior that you are expecting.
To locate your userpath, type:
>> userpath
To locate your "startup.m" file (if it is somewhere on your path), type:
>> which startup
The "userpath" is the standard location for the "startup.m" file. Here is the MATLAB Documentation page describing the use of a "startup.m" file: