How to add a folder permanently to matlab path?

795 visualizaciones (últimos 30 días)
Dishant Arora
Dishant Arora el 14 de Feb. de 2014
Comentada: Tzu-Cheng Hsueh el 11 de Dic. de 2023
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.

Respuesta aceptada

Thomas
Thomas el 14 de Feb. de 2014
Editada: Thomas el 14 de Feb. de 2014
You can put the addpath statement to startup.m
  2 comentarios
Roy Axford
Roy Axford el 31 de En. de 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.
Ronald Modesitt
Ronald Modesitt el 20 de Dic. de 2020
I am also using this method for my user written functions.

Iniciar sesión para comentar.

Más respuestas (2)

Jan
Jan el 14 de Feb. de 2014
addpath YourFolder
savepath
  2 comentarios
Aysu Soezbir
Aysu Soezbir el 7 de Dic. de 2023
best and easiest advice guys
Tzu-Cheng Hsueh
Tzu-Cheng Hsueh el 11 de Dic. de 2023
Best answer, thanks! Just to remind that all the folder name should not have space between or it could get wrong

Iniciar sesión para comentar.


Luís Fresco
Luís Fresco el 3 de Jul. de 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 comentarios
Roy Axford
Roy Axford el 31 de En. de 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 el 29 de Mzo. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Search Path en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by