How do I save path for future sessions?
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to finish the MATLAB code shown below. What the code does now is that it adds a folder and subfolders to the MATLAB path. The problem I am having is trying to save the path for future sessions and not just current sessions.I know you can save the path with the set path toolbox but I need to include the save for future sessions in the code format. I think the correct way to go might be the savepath function, however, I do not have a pathdef.m file in the folder of the script shown below I am trying to run. Also, I do not want to lose my existing MATLAB path. Thanks,
%%%%%%%%%%%%%%
location = pwd
addpath(genpath(location))
0 comentarios
Respuestas (1)
Walter Roberson
el 19 de Nov. de 2017
Editada: Walter Roberson
el 19 de Nov. de 2017
If you cannot save the path to a pathdef.m then you will need to have the addpath() in your code.
If this is just an optimization, to save the trouble of tracking down the files, then you might want to consider using setpref() and getpref() to remember the path -- but keep in mind that setpref and getpref have their own cost.
0 comentarios
Ver también
Categorías
Más información sobre Search Path en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!