%% Sort Rows of Tall Cell Array
% Sort text in a tall cell array of character vectors.
% Create a tall cell array using the UniqueCarrier text data in the airlinesmall.csv data set.

ds = datastore('airlinesmall.csv','SelectedVariableNames','UniqueCarrier');
tt = tall(ds);
A = tt.UniqueCarrier

%
% Sort the rows of C and return the top 10 rows. Collect the values into memory to view the results.

b = topkrows(A,10)

%

B = gather(b)

%
% By default topkrows sorts in reverse alphabetical order. Specify ascend as the fourth input to sort in alphabetical order.

c = topkrows(A,10,1,'ascend')

%

C = gather(c)

% Copyright 2012 The MathWorks, Inc.