matlab-正则表达提取字符串中的数字、批量解压gz文件、dir和fullfile一起使用筛选

regex='\d+'; 提取多个连续数字
str='today is 2012 year 12 month 09 day'
matches=regexp(str,regex,'match');
nums=str2double(matches);
结果是【2012,12,09】

找到gz文件
rootPath='xxxx';
gzFiles=dir(fullfile(rootpath,'**','*.gz')) 只检索当前文件和子文件下的gz文件,不检索子文件的子文件,需要用到递归。得到一个struct,里面有文件名字
for循环,逐个解压gz files
gunzip(tarGzfile, tarFolder)。解压的文件和解压后的路径