How to add a folder permanently to matlab path?

1,283 views (last 30 days)
Dishant Arora
Dishant Arora on 14 Feb 2014
Commented: Ronald Modesitt on 20 Dec 2020
I am using addpath to add specified folders to matlab path, but it removes the folders from the matlab path everytime the application closes. I want to add that particular folder permanently to matlab path, so that I don't have to add it again everytime i run the application. How can it be done??
Any help is appreciated.

Accepted Answer

Thomas
Thomas on 14 Feb 2014
Edited: Thomas on 14 Feb 2014
You can put the addpath statement to startup.m
  2 Comments
Ronald Modesitt
Ronald Modesitt on 20 Dec 2020
I am also using this method for my user written functions.

Sign in to comment.

More Answers (2)


Luís Fresco
Luís Fresco on 3 Jul 2019
On Matlab's toolstrip, you may find the option "Set Path" which allows to select one directory (or also its subfolders) and save it permanently to Matlab's "search path".
Untitled.png
  2 Comments
adrieto
adrieto on 29 Mar 2020
I used the solution proposed by Luis Fresco. It worked (I didn't need to do it every time I restarted MatLab). Into the default search path I added a new folder with some functions in it. I put "Add with subfolders", selected the main folder and when a new window pop-up, just accept that.
I wrote a script in the main folder which uses a function into the subfolder, and it worked just fine. I restarted MatLab to check if the solution was permanently, and it is.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!