wolffd@0: function addtosystempath(p) wolffd@0: % Add p to the system path. If p is already on the path, this does nothing. wolffd@0: % Note, this change only persists for the duration of the Matlab session. wolffd@0: % Do not include path delimiters like ; or : . wolffd@0: % Example: wolffd@0: % addtosystempath('C:\Users\matt\bin'); wolffd@0: wolffd@0: if isempty(getenv('PATH')) || all(cellfun(@(c)isempty(c),strfind(tokenize(getenv('PATH'),pathsep()),p))); wolffd@0: setenv('PATH', [p, pathsep(), getenv('PATH'),]); wolffd@0: end wolffd@0: wolffd@0: end