For the following example:
A = strings(10,1);
B = rand(10,1);
you could use a table:
T = table(A, B);
sortedT = sortrows(T, 'B')
or a cell array (although I'd probably consider the table to be the better option):
C = [cellstr(A), num2cell(B)];
sortedC = sortrows(C, 2)
0 Comments
Sign in to comment.