Sort complicated Array low -->top

조회 수: 1 (최근 30일)
Max Müller
Max Müller 2014년 8월 25일
댓글: Max Müller 2014년 8월 26일
Hey Guys I have this Array.Now i need to sort by the Values in the brackets. This Values go from 1 to 255. Does anybody has an idea how i can get this Values ?
InputData
ans =
Columns 1 through 8
'J_012(105)' 'J_013(106)' 'J_014(107)' 'J_015(2)' 'J_016(94)' 'J_017(95)' '

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 8월 25일
A={'J_012(105)' 'J_013(106)' 'J_014(107)' 'J_015(2)' 'J_016(94)' 'J_017(95)'}
s=regexp(A,'(?<=\().+(?=\))','match')
[~,idx]=sort(str2double([s{:}]))
out=A(idx)

추가 답변 (1개)

Max Müller
Max Müller 2014년 8월 26일
Matlab says to
[~,idx] = sort(str2double([s{:}]))
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.
  댓글 수: 1
Max Müller
Max Müller 2014년 8월 26일
but your idear is greate.... thanks

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

카테고리

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