Compare data in excel to folder location mat files.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi! so I have a list of mat files that I want to extract to separate folder location. The list is in excel sheet and the mat files are stored in the windows folder, is there a way that I can compare the name in excel sheet with the files in the folder location and for every positive match extract the file and save it to a new folder.
0 commentaires
Réponses (1)
KL
le 12 Sep 2017
Modifié(e) : KL
le 12 Sep 2017
[~,filenames,~]=xlsread('your_excel_file.xls');
folderInfo = dir('your_folder/*.mat');
folder_filenames = {folderInfo.name};
for iFile=1:numel(filenames)
ind = 0;
ind=find(ismember(folder_filenames,filenames{iFile}));
if(ind~=0)
S(iFile).data=load(folder_filenames{iFile});
% here you could save S(iFile).data in whatever format you want to
% export and save it in different folders.
% save your target folder names in a cell array and use them
% using indexing
ind = 0;
end
end
0 commentaires
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!