How to choose the default search path at startup?

3 views (last 30 days)
I have a directory in my search path that is causing trouble. I would like to permanently delete it. When MATLAB is open, I go to Set Path, delete the directory, and save. But when I exit MATLAB and start it again, the directory comes back at the top of my search path. (It does not come back on a different computer I have.) Would you please advise how I can permanently remove the directory from my search path so that I don't have to manually delete it every time I start MATLAB? Thank you.

Answers (2)

Aref Majdara
Aref Majdara on 29 Apr 2018
Hi Lubos,
In 'Home' tab, go to 'Preferences', then to 'General'.
  1 Comment
Lubos Pastor
Lubos Pastor on 30 Apr 2018
Thank you but perhaps I was unclear. Your suggestion would help me set the initial working folder. But my problem is different---it is that MATLAB's search path always resets to include an undesirable directory, even after I manually delete that directory from the Set Path menu and save.

Sign in to comment.


Image Analyst
Image Analyst on 30 Apr 2018
Edit your startup.m file and look for things in there that are changing your search path. Delete anything you see that you don't like. If you want, you can put this into your startup.m file:
restoredefaultpath % Only if necessary
cd('C:/whatever/folder/you/want'); % Have it start in whatever folder you want it to.
  2 Comments
Lubos Pastor
Lubos Pastor on 30 Apr 2018
Thank you. I don't seem to have a startup file:
>> which startup
'startup' not found.
I have tried creating one and saving it in the MATLAB/R2017b/toolbox/local directory (where my pathdef.m is) but it said I don't have the permission to do so. But I am hesitant to ask my admin to mess with the startup file because on my other laptop I don't have a startup.m file either and yet I don't have the problem with the startup path. The problem appears to be elsewhere, yet I don't know where...
Image Analyst
Image Analyst on 30 Apr 2018
My startup.m file is in d:\MATLAB. I set a path to that folder with the SetPath button. Be sure to save it once you specify it. I have all kinds of stuff in my startup.m file that I want to do. If all you want to do is set the starting "current folder" to be what you want, then use Aref's solution.

Sign in to comment.

Categories

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

Tags

Products

Community Treasure Hunt

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

Start Hunting!