sorting string based on the value in it

5 views (last 30 days)
Sajid Afaque
Sajid Afaque on 8 Jan 2020
Commented: Stephen23 on 8 Jan 2020
'temp_25_vgs_4',
'temp_25_vgs_5' ,
'temp_25_vgs_8' ,
'temp_25_vgs_6' ,
'temp_25_vgs_9',
'temp_25_vgs_7'
how do i sort the above in the increasing order of vgs.
how to sort the above kind of strings..i need it in order (
'temp_25_vgs_4'
'temp_25_vgs_5'
'temp_25_vgs_6'
'temp_25_vgs_7'
'temp_25_vgs_8'
'temp_25_vgs_9'
)
  4 Comments
Sajid Afaque
Sajid Afaque on 8 Jan 2020
is their anyway where we can do without using these functions
Stephen23
Stephen23 on 8 Jan 2020
"is their anyway where we can do without using these functions"
Of course: parse the string to split/extract all relevant characters and numbers (e.g. based on a regular expression or isstrprop), convert the numbers to numeric, sort. You can search this forum to find examples of this, the search field is at the top of the page.

Sign in to comment.

Answers (0)

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!