Question: 6 . Index sorting of strings in a cell array can also be accomplished with the built - in MATLAB sorting functions if a second

6. Index sorting of strings in a cell array can also be accomplished with the built-in MATLAB sorting functions if a second optional output argument is specified when calling the function:
>>[y,J]= sort(x) or >>[y,J]= sortrows(x)
Here, J is the index vector and y is the sorted version of cell array x, where y = x{J}. One important disadvantage of sort is that while it will accept a cell array of strings, or a regular (double) array of numbers, it will not accept a cell array of numbers.
The built-in sortrows function, on the other hand, has the advantage of accepting a cell array of either strings or numbers (note for Octave users: this is not true for Octaves sortrows function). One potential issue with sortrows is that by default it sorts down a column. Note

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!