list_fold = dir(path_fold);
% Find only folders
idx_fold = [list_fold(:).isdir];
% Select only folders
name_fold = {list_fold(idx_fold).name}';
% Remove '.' and '..'
name_fold( ismember(name_fold, {'.','..'}) ) = [];
NOTE that if you delete '.' and '..' like as follows
it might cause problem since 'dir' output from root directory does not contain '.' and '..' at least on Windows OS.
No comments:
Post a Comment