Mercurial > hg > ltpda
comparison m-toolbox/classes/+utils/@helper/remove_cvs_from_matlabpath.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % newpath = remove_cvs_from_matlabpath(oldpath) | |
2 % | |
3 % An utility function to remove CVS folders from the given path | |
4 % If no output is provided, it will use and set the current Matlab path | |
5 % | |
6 % D Nicolodi 25/03/2011 | |
7 % | |
8 % VERSION: $Id: remove_cvs_from_matlabpath.m,v 1.3 2011/05/05 14:10:09 ingo Exp $ | |
9 % | |
10 | |
11 function newpath = remove_cvs_from_matlabpath(oldpath) | |
12 | |
13 % if a path is not given load current matlab path | |
14 if nargin < 1 | |
15 oldpath = matlabpath(); | |
16 end | |
17 | |
18 newpath = ''; | |
19 while true | |
20 % split path definition into components | |
21 [p, oldpath] = strtok(oldpath, pathsep); | |
22 if isempty(p) | |
23 break; | |
24 end | |
25 | |
26 % remove components if it ends with CVS | |
27 [dummy, name] = fileparts(p); | |
28 if ~strcmp(name, 'CVS') | |
29 newpath = [newpath, pathsep, p]; | |
30 end | |
31 end | |
32 | |
33 % remove initial pathsep | |
34 newpath = newpath(2:end); | |
35 | |
36 % if a path was not given save the new path | |
37 if nargin < 1 | |
38 path(newpath); | |
39 end | |
40 | |
41 end |