# MATLAB: Sort cell array in descending order based on 2nd column

MATLAB

i have cell array and want to sort it based on 2nd column .
i have tried this
[~,idx] = sort([AA{:,2}]);
idx([1:2:end,2:2:end]) = idx;
B = AA(idx,:);
but 2nd column in not in descending order .

[~, idx] = sort([A1{:,2}], 'descend'); A1_descendingOrder = A1(idx,:)