我有以下代码:
myFiles = {fullfile(working, 'file1'),fullfile(working, '*.txt'),...
fullfile(folder1, 'controllerX'))};
switch (test)
case 'test1'
myFiles = {fullfile(working, folder1, '*.txt'),...
fullfile(working, folder1,folder2,'test.xml')};
case 'test2'
myFiles = {fullfile(working, folderX, '*.txt'),...
fullfile(working, folder1,folder2,'test.xml')}
end
for m = 1:numel(myFiles )
file = dir(myFiles{m});
verify(numel(file) == 1)
end
问题是在循环中仅对 case1 或 2 执行检查,即: numel(myFiles) = 在 case1 或 case 2 中找到的文件数,所以我第一次将值分配给 myFiles 时,不会保存值... . 我希望 myFiles = 第一次的文件数和 case 1 或 case 2 中的数字