How can I use wildcard '*' in both the folder name and file name when using DIR in MATLAB 7.9 (R2009b)?
48 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2009-10-23
编辑: MathWorks Support Team
2014-9-23
Under UNIX, the following works :
>> ls (fullfile(matlabroot, 'toolbox/matlab/audio*/*.m'))
But DIR does not support wildcard in both the folder and the file name :
>> dir ('C:/WORK/MATLAB_WORK/M*')
MATHS MCC MEX ML MLCentral MPC555 Mapping MyProject
>> dir ('C:/WORK/MATLAB_WORK/ML/*.m')
datenum_6b.m test.m
largest_memory_block_available.m
>> dir ('C:/WORK/MATLAB_WORK/M*/*.m')
C:\WORK\MATLAB_WORK\M*\*.m not found.
采纳的回答
MathWorks Support Team
2013-10-18
The ability to use DIR with wildcard (*) in both the folder and the path name is not available in MATLAB 7.9 (R2009b).
To work around this issue, you can write your own function which will act as follow :
list_dir = dir('/appli/matlab/r2008b/toolbox/matlab/graph*');
for i = 1:length(list_dir)
list_files = dir(['/appli/matlab/r2008b/toolbox/matlab/' list_dir(i).name '/*.m']);
end
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!