您可以使用readtable函数加载excel文件。
myexcel = readtable (“myexcel.xlsx”);
您可以使用dir函数列出该目录及其子目录中的所有dir文件。
mydir =“C: \ somedir \”;
myartfiles = dir (fullfile (mydir“* *”,‘* .art‘));
然后,您可以比较文件名,然后使用复制文件函数复制它们。
mycopydir =“C: \ copydir \”;
samefiles = ismember ({myartfiles.name}, myexcel.name);
filestocopy = myartfiles (samefiles);
为i = 1:长度(filestocopy)
origpath = fullfile (filestocopy(我).folder filestocopy (i) . name);
destpath = fullfile (mycopydir filestocopy (i) . name);
拷贝文件(origpath destpath);
结束