Sorting Strings:
For the matrix of strings, the sort function works exactly as formerly for numbers. For illustration,
>> words = char('Hi', 'Hello', 'Howdy', 'Goodbye', 'Ciao')
words =
Hi
Hello
Howdy
Goodbye
Ciao
The sorts below column-by-column by using the ASCII equivalents of the characters. It can be seen from the outcomes that the space character comes before the letters of the alphabet in the character encoding:
>> sort(words)
ans =
Ce
Giad
Hildb
Hoolo
Howoyye