Complicated Question / String Arrays
1 view (last 30 days)
Show older comments
Hey Guys, i have an array of strings which looks like this:
'J_012(105)' 'J_013(106)' 'J_014(107)' 'J_015(2)' J_016(94)' 'J_017(95)'
But I need it to look like this:
'J_012' 'J_013' 'J_014' 'J_015' 'J_016' 'J_017'
So That the ALWAYS the last 4Strings are deleted/kill. Is this possible ?
0 Comments
Accepted Answer
More Answers (1)
Azzi Abdelmalek
on 24 Jul 2014
A={'J_012(105)' 'J_013(106)' 'J_014(107)' 'J_015(2)' 'J_016(94)' 'J_017(95)'}
B=cellfun(@(x) x{1} ,regexp(A,'.+(?=\()','match'),'un',0)
See Also
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!