MATLAB: What will be the query for calling a folder(by path) to do the following loop or anything

calling folder

what will be the query for calling a folder(by path) to do the following loop or anything?

Best Answer

projectdir = 'path/to/the/folder';
dinfo = dir(projectdir);
dinfo( ismember({dinfo.name}, {'.', '..'}) ) = []; %get rid of . and ..
dinfo( [dinfo.isdir] ) = []; %get rid of subfolders if you want to
entries = fullfile(projectdir, {dinfo.name} );
numfiles = length(entries);
results = cell(numfiles, 1);
for K = 1 : numfiles
thisentry = entries{K};
% process information for thisentry
...
results{K} = ....
end
Related Question