MATLAB Answers

How to add a folder permanently to matlab path?

조회 수: 1,116(최근 30일)
Dishant Arora
Dishant Arora 14 Feb 2014
댓글: adrieto 29 Mar 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.

  댓글 수: 0

댓글을 달려면 로그인하십시오.

채택된 답변

Thomas
Thomas 14 Feb 2014
편집: Thomas 14 Feb 2014
You can put the addpath statement to startup.m

  댓글 수: 1

Roy Axford
Roy Axford 31 Jan 2020
This method works best and I have adopted it. Using it makes it unnecessary to maunally add the desired paths and folders at the beginning of a MATLAB session, thereby saving a step.

댓글을 달려면 로그인하십시오.

추가 답변(3개)

Jan
Jan 14 Feb 2014
addpath YourFolder
savepath

  댓글 수: 0

댓글을 달려면 로그인하십시오.


Luís Fresco
Luís Fresco 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

Roy Axford
Roy Axford 31 Jan 2020
This solution has merit in that it takes advantage of the tool strip and it works. But it is not permenant. It must be repeated each time I restart MATLAB.
adrieto
adrieto 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.

댓글을 달려면 로그인하십시오.


sipsj11
sipsj11 2 May 2017
I'm running into an issue if I'm not connected to the network drive in the path it removes it, has anyone come up with a solution that makes it stick?

  댓글 수: 1

Jan
Jan 3 May 2017
Please open a new thread for a new question. Posting questions in the section for answers is confusing.
Then please explain exactly, which issues you have.

댓글을 달려면 로그인하십시오.


Translated by