Answers for "list subdirectories in matlab"

0

list subdirectories in matlab

% Get a list of all files and folders in this folder.
files = dir('C:\Users\John\Documents\MATLAB\work')
% Get a logical vector that tells which is a directory.
dirFlags = [files.isdir]
% Extract only those that are directories.
subFolders = files(dirFlags)
% Print folder names to command window.
for k = 1 : length(subFolders)
  fprintf('Sub folder #%d = %s\n', k, subFolders(k).name);
end
Posted by: Guest on August-31-2021

Code answers related to "list subdirectories in matlab"

Browse Popular Code Answers by Language