build the path yourself and do a single call to addpath, addpath expects a single string containing path names separated by semicolons. So try something like the following:
apath = 'S:\top_code_directory\some_subdirectory;'
newpath = [genpath('S:\project_directories'), apath];
addpath(newpath);
Obviously your construction of the path string to add will be more complex. Just remember that genpath already produces a string ending in a semicolon so you don't need to add one to the string produced by it.
You will find this much faster, as the bottleneck is the function path.m
1 Comment
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/42675-slow-matlab-startup-if-startup-m-contains-many-path-additions#comment_87596
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/42675-slow-matlab-startup-if-startup-m-contains-many-path-additions#comment_87596
Sign in to comment.