www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SpecifySortingDirectionsForMatrixRowsExample.m

    %% Specify Sorting Directions for Matrix Rows
% Sort a tall matrix using several columns with different sorting
% directions.
%
% Create a 100-by-5 matrix of random integers. Convert the in-memory array
% into a tall array.
X = randi(10,100,5);
TX = tall(X)

%%
% Sort |TX| using the first three columns and return the top 12 rows.
% Specify the sorting direction for each column. Collect the values into
% memory to view the compete results.
T = topkrows(TX,12,1:3,{'descend','ascend','ascend'})

%%
T12 = gather(T)