function dirs = listDirs(wd) % d = listDirs(dir) returns all directories below dir as a cell array. % the Structure is the same as from the 'dir' command (because this % function relies on 'dir' % .* is filterd. no intetion to include an option switch for those % special dirs. allfiles = dir(wd); nDirs = 1; for i = 1:size(allfiles) file = allfiles(i); if file.isdir && file.name(1)~='.' dirs{nDirs}=file; nDirs = nDirs +1; end end