How to separate a portion of filename from a file
11 次查看(过去 30 天)
显示 更早的评论
How to separate a portion of filename from a file like I have the file 'scrubbed.MOD_D3_AOD_550.20020112.nc' I just want to extract the '20020112' part
0 个评论
采纳的回答
更多回答(3 个)
Image Analyst
2019-9-8
Try strsplit():
parts = strsplit('scrubbed.MOD_D3_AOD_550.20020112.nc', '.') % Separate in between dots.
yourNumber = parts{end-1} % Take the next to the last one.
2 个评论
madhan ravi
2019-9-8
regexp('scrubbed.MOD_D3_AOD_550.20020112.nc',...
'\d*(?=\.nc)','match','once')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 String Parsing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!