create filedatastore of mat files filtering files by filename pattern

3 views (last 30 days)
Is it possible to create a filedatastore of mat files filtering files by filename pattern?
So far I got this:
fds = fileDatastore(dir_save,'ReadFcn',@load,'FileExtensions','.mat','IncludeSubfolders',true);
f=1;
while hasdata(fds)
disp(num2str(progress(fds)*100)
dataarray = read(fds);
if ~isempty(strfind(fds.Files{f},myPattern))
%% do somthing
end
f=f+1;
end
But some mat files I will not be using are really large and therefore slow down the process.
I cannot move all the files to 1 directirory because my directory structure is like:
d01/file1.mat
d01/myPatternFile.mat
d01/othefile.mat
d02/file1.mat
d02/myPatternFile.mat
d02/othefile.mat
etc

Answers (0)

Categories

Find more on Search Path in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!