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

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by