sorting string based on the value in it

조회 수: 5 (최근 30일)
Sajid Afaque
Sajid Afaque 2020년 1월 8일
댓글: Stephen23 2020년 1월 8일
'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
Sajid Afaque
Sajid Afaque 2020년 1월 8일
is their anyway where we can do without using these functions
Stephen23
Stephen23 2020년 1월 8일
"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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by