MATLAB: How to use SORT to sort a cell array of characters in descending order in MATLAB 7.6 (R2008a)

MATLAB

I would like to sort a cell array of characters in the descending order using the SORT command. The SORT command using the 'descend' option gives an error.
Reproduction Steps:
str = {'a' 'b' 'c'; 'b' 'c' 'a'; 'c' 'a' 'b'}
sort(str, 'descend');

Best Answer

The ability to sort a cell-array using the 'descend' option is not available with the SORT command in MATLAB.
As a workaround, to create a cell array of descending order, perform the operations FLIPLR and FLIPUD on the output of SORT.
str = {'a' 'b' 'c'; 'b' 'c' 'a'; 'c' 'a' 'b'};
sortedstr = sort(str);
flipud(fliplr(sortedstr));