MATLAB: How to count number of folder

count file

I do know how to count the number of files within the folder like this,
but is their way to file the number of folder inside the certain folder? (not file)

Best Answer

all_files = dir;
all_dir = all_files([all_files(:).isdir]);
num_dir = numel(all_dir);