MATLAB: Sort a list of files

sort

Hey guys,
i have a problem to sort my files which i load with "dir".
i want to sort my list depending on three numbers.
my unsorted list looks like:
'dantec7100_Ma=01_wait_1000_ Yaw -10,00° Pitch -10,00°'
'dantec7100_Ma=01_wait_1000_ Yaw -10,00° Pitch -15,00°'
'dantec7100_Ma=02_wait_1000_ Yaw -10,00° Pitch -10,00°'
'dantec7100_Ma=02_wait_1000_ Yaw -10,00° Pitch -15,00°'
'dantec7100_Ma=01_wait_1000_ Yaw 10,00° Pitch 10,00°'
'dantec7100_Ma=01_wait_1000_ Yaw 10,00° Pitch 15,00°'
'dantec7100_Ma=02_wait_1000_ Yaw 10,00° Pitch 10,00°'
'dantec7100_Ma=02_wait_1000_ Yaw 10,00° Pitch 15,00°'
….
Ma goes from 01 to 07
Yaw goes from -20 to 20
Pitch goes from -20 to 20
I want the following sequence for all "Ma" starting from 01 to 07:
I want to start with "Ma=01". Then the lowest Yaw-Angle (-20) has to follow and to be fixed, and the pitch angles have to follow from the lowest to the highest (-20 to 20). Than increase the yaw angle to -5 and run again all pitch angle from -20 to 20, and so on for all yaw-angles. When this is ready, i want to increase "Ma" to 02 and do the same again.
i hope my problem is clear.

Best Answer

data = { 'dantec7100_Ma=01_wait_1000_ Yaw -10,00° Pitch -10,00°'
'dantec7100_Ma=01_wait_1000_ Yaw -10,00° Pitch -15,00°'
'dantec7100_Ma=02_wait_1000_ Yaw -10,00° Pitch -10,00°'
'dantec7100_Ma=02_wait_1000_ Yaw -10,00° Pitch -15,00°'
'dantec7100_Ma=01_wait_1000_ Yaw 10,00° Pitch 10,00°'
'dantec7100_Ma=01_wait_1000_ Yaw 10,00° Pitch 15,00°'
'dantec7100_Ma=02_wait_1000_ Yaw 10,00° Pitch 10,00°'
'dantec7100_Ma=02_wait_1000_ Yaw 10,00° Pitch 15,00°'};
a = regexp(data,'(\-)?\d+(,\d+)?','match');
b = regexprep(cat(1,a{:}),',','.');
[~,ii] = sortrows(str2double(b(:,[2,4,5])));
out = data(ii);