Very simple question about strings
Show older comments
Hello all
I have a cell containing stings something like this:
A={'SI1','SI12','SI13','SI2'};
I have to arrange these strings either in ascending order or in descending based on the numbers they are having. Can anyone please guide?
Regards
1 Comment
You can simply use my FEX submission natsort, which performs a natural order sort on a cell array of strings:
>> A = {'SI1','SI12','SI13','SI2'};
>> natsort(A)
ans =
'SI1' 'SI2' 'SI12' 'SI13'
Accepted Answer
More Answers (1)
Honglei Chen
on 1 Aug 2014
0 votes
I think this utility can help
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!