MATLAB: Load multiple files in right order

indexnameorder

Hello,
I'm loading multiple mat-files in workspace, the names of files are:
Schweben_Meg_2_2-01_SNR_-030_PLL.mat
Schweben_Meg_2_2-01_SNR_-015_PLL.mat
Schweben_Meg_2_2-01_SNR_000_PLL.mat
Schweben_Meg_2_2-01_SNR_015_PLL.mat
Schweben_Meg_2_2-01_SNR_030_PLL.mat
the answers will be writen to one result files. The problem – MATLAB loads this files in "wrong" order.
First it takes:
Schweben_Meg_2_2-01_SNR_-015_PLL.mat
than
Schweben_Meg_2_2-01_SNR_-030_PLL.mat
than
Schweben_Meg_2_2-01_SNR_000_PLL.mat
…..
I want to get a loading order:
Schweben_Meg_2_2-01_SNR_-030_PLL.mat first
than
Schweben_Meg_2_2-01_SNR_-015_PLL.mat
than
Schweben_Meg_2_2-01_SNR_000_PLL.mat
it is possible to read a data in "right" order without rename of all the files? (I have about 1000x of thoose files)
Thank you!

Best Answer

Download my FEX submission natsortfiles:
and use the regular expression '-?\d{3}' (or similar), e.g.:
D = 'path to the folder where the files are saved';
S = dir(fullfile(D,'Schweben*PLL.mat'));
C = natsortfiles({S.name},'-?\d{3}');