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

1 view (last 30 days)
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.

Answers (1)

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

Community Treasure Hunt

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

Start Hunting!