subdir_info = dir(dataDir);
subdir_info(~[subdir_info.isdir]) = [];
subdir_info(ismember({subdir_info.name}, {'.', '..'})) = [];
subdir_names = fullfile(dataDir, {subdir_info.name});
Now subdir_names is a cell array of character vectors that are the fully qualified names of the folders directly under the one that the user selected.
If you need all the nested subfolders too then see rdir() in the File Exchange, or you can do it using R2016b or later (I think it is, perhaps it was R2017a) using wildcards.
Best Answer