I have saved a pathdef file ('pathdef_etc.m') which contains the paths that I need for a given project. I simply want to get the string output from this pathdef file, so that I can add it to my current path using 'addpath( path_string )'.
The output is a single cell containing a n-by-1 cell array of character vectors (one per line in the input file). So C{1}{1} contains the first line of your file, C{1}{2} the second, and so on. You could then set up a loop to add each line to the path:
Hi, thank you for the answer! I will give this a try.
It is just that I think there is a really straightforward answer. I saw it implemented once, I just can't remember how. It was almost as simple as just clicking the pathdef file in the file explorer, then addpath(ans) or something like that.
When I click the pathdef.m file, it opens up a function p=pathdef , which includes the pathdef search results (all the folders in path), and in the header says..
% PATHDEF returns a string that can be used as input to MATLABPATH
% in order to set the path.
Which makes me think it should be simpler, without any parsing or looping.
However, your help/code has gotten me halfway there so thanks alot! This may work fine.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.