フィルターのクリア

How to use regexp to filter the following file names?

1 回表示 (過去 30 日間)
Devarshi Patel
Devarshi Patel 2019 年 6 月 10 日
コメント済み: Devarshi Patel 2019 年 6 月 11 日
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

採用された回答

convert_to_metric
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.
  1 件のコメント
Devarshi Patel
Devarshi Patel 2019 年 6 月 11 日
Thank you! It really helped.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by