Skip to main content

findFirstLevelSubDirectoriesFromPrefixes.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function looks in the given directory for all subdirectories and
% returns their names as a string array
%
% (string, Array of string) -> (Array of string)
% returns a 3D matrix of the loaded muscle tendon length data


function dirs = findFirstLevelSubDirectoriesFromPrefixes( ...
inputDirectory, prefixes)
listings = dir(inputDirectory);
dirs = string([]);
for i=1:length(prefixes)
for j=1:length(listings)
index = strfind(listings(j).name, prefixes(i));
if(length(index)==1)
dirs(end+1) = fullfile(inputDirectory, listings(j).name);
break
end
end
end
dirs = string(dirs);
end