How to use regexp to filter the following file names?
1 次查看(过去 30 天)
显示 更早的评论
Hello, lets assume that I have the following file format for my files,
fig_figure_mat2007_03_04_yield_2007_03_05
fig_figure_mat2008_03_07_yield_2008_03_08
fig_figure_mat2007_03_05_yield_2007_03_06
fig_figure_mat2008_04_05_yield_2008_04_06
How can I use regexp in this to sort the files out just by using the first bit of the date such as files are sorted in following order:
2007_03_04
2007_03_05
2008_03_07
2008_04_05
0 个评论
采纳的回答
convert_to_metric
2019-6-10
Hi Devarshi,
Since your filenames have a predictable structure of consistent length, you could use hard coded indexing to extract that date and avoid regexp altogether. If filename is a character array containing fig_figure_mat2007_03_04_yield_2007_03_05, filename(15:24) should return the section you're looking for.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!