If you have a look athttps://www.mathworks.com/help/matlab/ref/categorical.html then you can see that when you construct the categorical array, you can pass "valueset" as the second parameter, and that the categories would be ordered according to the values in valueset. So you could pass the populations of the states in the second parameter, and the corresponding state names in the third parameter, and that would create names sorted by population.
Best Answer