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!