Sort complicated Array low -->top
2 次查看(过去 30 天)
显示 更早的评论
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)' '
0 个评论
采纳的回答
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)
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!