How do I save path for future sessions?
16 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Walter Roberson
2017 年 11 月 19 日
編集済み: Walter Roberson
2017 年 11 月 19 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Search Path についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!