function allSubPath = getAllSubs(filepath)
% getAllSubs 
%   getAllSubs gets the folder's all subfolders, including this folder
%   allSubPath = getAllSubs(filepath)

%   Project: IMPACT
%   Title of Code: getAllSubs
%   Relevant additional documentation:
%   Developer: Carlos Gonzalez
%   External Dependencies: NA
%
%   Disclaimer
%   CAUTION: It is strongly recommended that changes to this code
%   should be avoided without first consulting with authors.


all = dir(filepath);
allName = {all.name};
isdir = [all.isdir];
subPath = allName(isdir);

%%
nSubPath = numel(subPath);

allSubPath = {filepath};
for m = 3:nSubPath
    allSubs = getAllSubs(fullfile(filepath, subPath{m}));
    allSubPath = [allSubPath, allSubs];
end


