matlab-正則表達(dá)提取字符串中的數(shù)字、批量解壓gz文件、dir和fullfile一起使用篩選

regex='\d+';? 提取多個(gè)連續(xù)數(shù)字
str='today is 2012 year 12 month 09 day'
matches=regexp(str,regex,'match');
nums=str2double(matches);
結(jié)果是【2012,12,09】

找到gz文件
rootPath='xxxx';
gzFiles=dir(fullfile(rootpath,'**','*.gz'))? 只檢索當(dāng)前文件和子文件下的gz文件,不檢索子文件的子文件,需要用到遞歸。得到一個(gè)struct,里面有文件名字
for循環(huán),逐個(gè)解壓gz files
gunzip(tarGzfile, tarFolder)。解壓的文件和解壓后的路徑
標(biāo)簽: