How can I use wildcard '*' in both the folder name and file name when using DIR in MATLAB 7.9 (R2009b)?

44 views (last 30 days)
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.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Oct 2013
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

More Answers (0)

Categories

Find more on Software Development Tools in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2009b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!