How to locate and record the folder number that exceeds user defined value in a directory?

1 回表示 (過去 30 日間)
sam moor
sam moor 2019 年 3 月 2 日
回答済み: Image Analyst 2019 年 3 月 2 日
I have multiple folders in increasing order of last 4 digits in the directory as r1_0.05, r1_0.10, r1_0.15, r1_0.20...... In each folder I have multiple files but I am interested in one of file that is value.out. I want to run a loop in each folder of directory to find the folder that exceeds the user defined value (in my case 0.01). Once I found the folder that exceed 0.01 value, I want to record the last 4 digit of that folder in the matrix form. For example, say the user defined value just exceed in the folder r1_0.20 then I want to record the folder 4 digit and terminate the loop. Any idea is appreciated.

回答 (1 件)

Image Analyst
Image Analyst 2019 年 3 月 2 日
Have you tried to parse the folder name like
underlineLocation = strfind(folderName, '_');
theNumber = str2double(folderName(underlineLocation:end))
if theNumber > someThresholdNumber
% Do something
end

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by