wildcard in dir command - single char
조회 수: 17 (최근 30일)
이전 댓글 표시
how can i search files of pattern aaa0.... aaa1......
without finding the file aaa (without number)
at system dir command its " dir aaa? "
but i cant run this in matlab
i need the results as structure so i cant use system command
답변 (1개)
Stephen23
2019년 7월 23일
편집: Stephen23
2019년 7월 23일
dir does not support single-character wildcards.
You could remove the superfluous filenames afterwards, e.g.:
>> S = dir('aaa*.txt');
>> S.name
ans = aaa.txt
ans = aaa0.txt
ans = aaa1.txt
>> C = {S.name};
>> X = cellfun('isempty',regexp(C,'^aaa\d.txt$'));
>> S = S(~X);
>> S.name
ans = aaa0.txt
ans = aaa1.txt
댓글 수: 4
Anil Thota
2020년 9월 30일
Yes - Same Operating system. What is the wild character for specifying one character?
Thank you,
Anil
Walter Roberson
2020년 9월 30일
The Mathworks documentation says that wildcards for single characters is not supported.
참고 항목
카테고리
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!