matlab - What does this setup.m file do and what is it for? -
what this setup.m file do?
function setup %setup adds directories metrics matlab path % % author: ben hamner (ben@benhamner.com) mydir = fileparts(mfilename('fullpath')); paths = genpath(mydir); paths = strread(paths,'%s','delimiter',':'); pathstoadd = []; i=1:length(paths) thispath = paths{i}; thispathsplit = strread(thispath,'%s','delimiter','/'); addthispath = 1; % not add directories or files starting . or ~ j=1:length(thispathsplit) thisstr = thispathsplit{j}; if (~isempty(thisstr)) && ((thisstr(1) == '.') || (thisstr(1) == '~')) addthispath = 0; end end if addthispath ==1 if ~isempty(pathstoadd) thispath = [':' thispath]; end pathstoadd = [pathstoadd thispath]; end end addpath(pathstoadd); savepath; i understand description adds directories matlab's search path. 1 , why? matlab scripts scattered addpath('data') lines. mean don't have anymore? comments appreciated.
the file linking setup file metrics package - adds paths various folders can use metrics package without setting paths manually.
more setup.m function adds paths @ level , below located. if copy file directory , run - add directory , subdirs , subdirs of subdirs etc. (excluding folders starting . or ~)
but have hunch looking this: http://www.mathworks.com/help/matlab/ref/startup.html
http://www.mathworks.com/help/matlab/ref/matlabrc.html
Comments
Post a Comment