How do I sort files by part of their filename?

1 ビュー (過去 30 日間)
Janna Hinchliff
Janna Hinchliff 2021 年 8 月 23 日
編集済み: Yazan 2021 年 8 月 23 日
I have a set of files in a folder and the labelling is
Max_I=0.5
Max_I=1.0
Min_I=0.5
Min_I=1.0
etc.
I want to plot the data that is stored in the files but I want both of the files labeled with I=0.5 on one graph and both of the files labeled with I=1.0 on another graph (there are actually a lot more files than this), e.g. I want to sort them according to the value of I. Can this be done using regexp to sort the files or is there a better way?

回答 (1 件)

Yazan
Yazan 2021 年 8 月 23 日
編集済み: Yazan 2021 年 8 月 23 日
You can use the following to search for files in the current folder that have a specific name format:
P = dir('*I=0.5')
% P = dir('*I=1.0')

カテゴリ

Find more on File Operations in Help Center and File Exchange

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by