MATLAB: How to sort dataset in numberic order

sorting

Hi there, I have a question about how to sort rows in a text file.
I have a text file which involves a dataset as below.
FileName SDF
d_A1_A-1.txt 1.1
d_A1_A-10.txt 1.2
d_A1_A-11.txt 1.3
d_A1_A-12.txt 1.4
d_A1_A-13.txt 1.5
d_A1_A-14.txt 1.6
d_A1_A-15.txt 1.7
d_A1_A-16.txt 1.8
d_A1_A-17.txt 1.9
d_A1_A-18.txt 2.0
d_A1_A-19.txt 2.1
d_A1_A-2.txt 2.2
d_A1_A-20.txt 2.3
I imported this text file as a dataset using a code below.
A = dataset('File','SD_Force_Engram.txt')
I would like to ask you how I could order rows in number. Here is the dataset that I would like to ideally have below.
FileName SDF
d_A1_A-1.txt 1.1
d_A1_A-2.txt 2.2
d_A1_A-10.txt 1.2
d_A1_A-11.txt 1.3
d_A1_A-12.txt 1.4
d_A1_A-13.txt 1.5
d_A1_A-14.txt 1.6
d_A1_A-15.txt 1.7
d_A1_A-16.txt 1.8
d_A1_A-17.txt 1.9
d_A1_A-18.txt 2.0
d_A1_A-19.txt 2.1
d_A1_A-20.txt 2.3
I would appreciate your response.

Best Answer

fid = fopen('txtfile') ;
% S1 = textscan(fid,'%s','delimiter','\n') ; % get whole part
S2 = textscan(fid, '%s %f\r %*[^\n]','HeaderLines',2) ;
fclose(fid);
% S1=[S1{:}] ;
[val,idx] = sort(S2{2}) ;
%%arrange the file
fid = fopen('txtfile') ;
S1 = textscan(fid,'%s','delimiter','\n','HeaderLines',1) ; % get whole part
fclose(fid);
S1=[S1{:}] ;
S1 = S1(idx,:)