我正在尝试在与“hello”匹配的目录中查找所有文件。我有以下代码:
fileData = dir();
m_file_idx = 1;
fileNames = {fileData.name};
index = regexp(filenames,'\w*hello\w*','match') ;
inFiles = fileNames(~cellfun(@isempty,index));
前任。如果我的目录中有 3 个文件,其中包含单词 hello,inFiles 会返回我
inFiles =
[1x23 char] [1x26 char] [1x25 char]
相反,我希望 inFiles 向我返回文件名,例如 thisishello.m,hiandhello.txt 我怎样才能以简单的方式做到这一点?