Startup path issue creating variable errors

9 views (last 30 days)
I just deleted and installed a clean version of Matlab R2019b, because i was getting the error
Warning: Executing startup failed in matlabrc.
This indicates a potentially serious problem in your MATLAB setup, which should
be resolved as soon as possible. Error detected was:
MATLAB:load:couldNotReadFile
Unable to read file 'matlab.mat'. No such file or directory.
My startup.m was just 'load matlab.mat', so I saved the workspace as matlab.mat, and was able to run the application, but not add certain specific paths in that I wanted without getting a persistent popup saying "Variables - an unexpected error has occurred"
I tried restoredefaultpath and rehash toolboxcache, as well as restoredefaultpath;matlabrc .
Now, on the clean install, matlab can't find startup.m.
>> which startup.m
'startup.m' not found.
How is it possible that I don't have a startup.m file on a clean install? Please let me know if you have any thoughts, thanks in advance

Answers (1)

Stephen23
Stephen23 on 7 Jan 2020
Edited: Stephen23 on 7 Jan 2020
"How is it possible that I don't have a startup.m file on a clean install"
Because it is a clean install: MATLAB does not create this file, it is created by the user:
"Please let me know if you have any thoughts"
The documentation states "Create a startup.m file in the userpath folder, which is on the MATLAB® search path. Add commands you want executed at startup....", so that is probably what I would do, e.g. create a script with that name and save it in your startup folder:

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!