### Function ###
A "natural order" sort is where any numeric values occuring within the strings is taken into account in the sort. Compare for example:
>> A = {'File2.txt','File10.txt','File1.txt'};
>> sort(A)
ans = {'File1.txt','File10.txt','File2.txt'}
>> sortnat(A)
ans = {'File1.txt','File2.txt','File10.txt'}
# This function provides optional user-control over the numeric value format, allowing plus/minus signs, decimal points, exponents, etc., to be taken into account in the numeric values.
# This function is faster than other "natural order" Mfiles provided on MATLAB File Exchange.
### Example Usage ###
# The default is for integer values only, as shown above.
# Strings with decimal values, some with +/- signs:
>> B = {'File1.3.txt','File1.4.txt','File+0.3.txt','File-1.4.txt'};
>> sort(B)
ans = {'File+0.3.txt','File-1.4.txt','File1.3.txt','File1.4.txt'}
>> sortnat(B,'(-|+)?\d+\.\d+')
ans = {'File-1.4.txt','File+0.3.txt','File1.3.txt','File1.4.txt'}
# Strings with integer values, some as exponents:
>> C = {'File10e5.txt','File1000000.txt','File100.txt','File10e3.txt'};
>> sort(C)
ans = ={'File100.txt','File1000000.txt','File10e3.txt','File10e5.txt'}
>> sortnat(C,'(10e)?\d+')
ans = {'File100.txt','File10e3.txt','File10e5.txt','File1000000.txt'} |