I'm looking for an efficient way to solve the following issue:
Typically I read out all files in a directory that match a certain pattern by means of the dir function:
dirFiles = dir('Common_*_common.ext');
This does what it is supposed to do and gives me a nice cell array with files I need to load.
However, the pattern is of the format 0, 1, 2, ..., 8, 9, 10 and the order of my fileNames comes out as 0, 10, 1, ..., 7, 8, 9. Unfortunately, changing the filenames themselves to 00, 01, 02, ..., 10 is not an option. Is there an efficient way to sort such arrays to the correct format?
Of course this should also hold when the sequence increases to larger numbers (e.g. 0, 1, 2, ..., 29, 30, 31).