MatrixBerryCore
PathUtils.m
Go to the documentation of this file.
1 classdef PathUtils
2  methods (Static)
3  function pathStr=rmLastPathParts(pathStr,nPartsToRemove)
4  if isempty(pathStr)
5  mxberry.core.throwerror('wrongInput',...
6  'pathStr cannot be empty');
7  end
8  indVec=regexp(pathStr,filesep);
9  nPartsInTotal=numel(indVec);
10  if nPartsToRemove>0
11  pathStr=pathStr(1:(indVec(nPartsInTotal-nPartsToRemove+1)-1));
12  end
13  end
14  function pathList=genPathByRootList(pathToIncludeCVec,pathPatternToExclude)
15 
16  pathListOfLists=cellfun(@(x)mxberry.io.listdirsrecursive(x,...
17  ['regex:^(?:(?!(',pathPatternToExclude,')).)*$'],Inf),...
18  pathToIncludeCVec,'UniformOutput',false);
19  pathList=vertcat(pathListOfLists{:}).';
20  end
21  end
22 end
function filesep()