Your best bet here is to convert the timestamp data into datetime
. The datetime
constructor can automatically work out the format in this case, so here's all you need:
% Create table
t = table(["label1"; "label1"; "label2"], ...
["01/12/2020"; "26/11/2020"; "01/01/2021"], ...
[500; 553; 951], ...
["Type2"; "Type1"; "Type3"]);
% Convert Var2 into datetime format
t.Var2 = datetime(t.Var2);
% Now use sortrows
sortrows(t, 2)
This gives the result
3×4 table
Var1 Var2 Var3 Var4
________ ___________ ____ _______
"label1" 26-Nov-2020 553 "Type1"
"label1" 01-Dec-2020 500 "Type2"
"label2" 01-Jan-2021 951 "Type3"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…