Extracting values from file names to array
古いコメントを表示
Let's say I have a directory "mydirectory" and in it, I have some files
file_234.txt
file_356.txt
file_567.txt
file_987.txt
and I want to form an array in Matlab out of the respective numbers.
234
356
567
987
How can I go into the directory, extract the information from the files, and put each value into the array?
Thanks!
採用された回答
その他の回答 (1 件)
Sean de Wolski
2019 年 10 月 22 日
fn = ["file_234.txt"
"file_356.txt"
"file_567.txt"
"file_987.txt"]
double(extractBetween(fn, "_", "."))
カテゴリ
ヘルプ センター および File Exchange で File Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!