text - Read with order files in subfolders in matlab -
I have a folder that has subfolders with text files; I want to read those files in the same order because they are subfolders I have a problem with that I use the following matlab code:
outNames = {}; K = 1; Feature = zero (619,85); FileN = cell (619,1); For I = 1: length (nameFolds) dirList = dir (strcat (path, num2str (cell2mat (nameFolds (i, 1)))); Name = {dirList.name}; OutNames = {}; For J = 1: numel (names) name = names {j}; If ~ isequal (name, '.') & Amp; Amp; ~ Unequal (name, '..') [~, name] = fileparts (name {j}); Outname {end + 1} = name; FileName = strcat (path, num2str (cell2mat (nameFolds (i, 1)), '\', name, '.descr'); Feature (k, :) = script (filename); FileN {k} = [filename is num2str (k)]; K = k + 1; At the end of an interval I found the above text file names in a subfolder:
AnimalPrint_tiger_test_01.descr AnimalPrint_tiger_test_02.descr AnimalPrint_tiger_test_03.descr AnimalPrint_tiger_test_04.descr AnimalPrint_tiger_test_05 Kdeskr Animlprint_taigr_test_06kdeskr Animlprint_taigr_test_07kdeskr Animlprint_taigr_test_08kdeskr Animlprint_taigr_test_09kdeskr Animlprint_taigr_test_l0kdeskr Animlprint_taigr_test_llkdeskr Animlprint_taigr_test_l2kdeskr Animlprint_taigr_test_l3kdeskr Animlprint_taigr_test_l4kdeskr Animlprint_taigr_test_l5kdeskr Animlprint_zebra_test_lkdeskr Animlprint_zebra_test_2kdeskr Animlprint_zebra_test_3kdeskr Animlprint_zebra_test_4kdeskr Animlprint_zebra_test_5kdeskr Animlprint_zebra_test_l2kdeskr But it seems that before AnimalPrint_zebra_test_12.descr and AnimalPrint_zebra_test_1.descr and after the rest reads. Any idea why this happens?
diapers sorts the files according to their names For example, You may want to create your own order with ['test_' num2str] test_1 test_12% 1, followed by 2 test_2 test_3 (Variable) '.descr'] that code with a rising variable test_ .
Comments
Post a Comment