How to classify elements in a folder and its subfolder in Matlab for matching purposes -


i have folder dat contain n subfolders , these contain various .dat files

i need files in these subfolder stored in data structure myarchive contains file_name, subfolder_name , object resulanalysis result of analysis script

the purpose of operation obtain file_name , subfolder_name of entries in myarchive matches generic result

with code i'm able analysis result of files contained in current folder , have matching function, don't know how solve described classification problem.

files = dir('*.dat');  file = files'     im = load(file.name);     result=myanalyzer(im); end 

could me?

if has better strategy meet problem welcome.

thanks.

if understand correctly, want through subfolders, load .dat file, run analysis , see if result matches value. if matches wan save names of subfolder , file in data structure myarchive. if that's case, here's code:

topfolder = '...\dat\'; % specify full path dat folder cd(topfolder) subfolderlist = dir; subfolderlist = subfolderlist(3:end); % because first 2 results '.' , '..' counter = 0;   ii = 1:lenght(subfolderlist)     cd([topfolder,subfolderlist(ii).name])     filename = dir('*.dat');     im = load(filename); % assuming there 1 .dat file in folder      if myanalyzer(im) == result         counter = counter + 1;         myarchive(counter).subfolder_name = subfolerlist(ii);         myarchive(counter).filename = filename;     end end 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -