Compare data in excel to folder location mat files.
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
KL
el 12 de Sept. de 2017
Editada: KL
el 12 de Sept. de 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 comentarios
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!