Question

I have more than 30 save setpath in Matlab and I want to remove them first and test something and later on, I want to add them back. What would be optimized way of achieving this. Is there a method to get the list of saved setpath and later on add paths in setpath by providing a list. I tried getnpath and it returns the matlab toolboxes path.

Was it helpful?

Solution

Create a backup of paths in a mat file -

path_list = path;
save('paths.mat','path_list');

Do your thing of removing 30 saved paths by going to Set Path option on the File menu and do whatever testing you were looking to do.

Once done with the testing, now you wish to add back the deleted paths. So restore the paths from the backed up mat file -

load('paths.mat')
path(path_list)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top