MATLAB Answers

sorting string based on the value in it

4 views (last 30 days)
Sajid Afaque
Sajid Afaque 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

Show 1 older comment
Sajid Afaque
Sajid Afaque on 8 Jan 2020
is their anyway where we can do without using these functions
Stephen Cobeldick
Stephen Cobeldick 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)

Tags

Products