C = {'23414','342(1)','34','231'};
pfx = cellfun(@(s)regexp(s,'\d','match'),C,'UniformOutput',false);
fun = @(s)arrayfun(@(n)s(n:end),regexp(s,'(\d|\(\d\))'),'UniformOutput',false);
sfx = cellfun(fun,C,'UniformOutput',false);
and the two output cell arrays contain:
>> pfx{:}
ans =
'2' '3' '4' '1' '4'
ans =
'3' '4' '2' '1'
ans =
'3' '4'
ans =
'2' '3' '1'
>> sfx{:}
ans =
'23414' '3414' '414' '14' '4'
ans =
'342(1)' '42(1)' '2(1)' '(1)'
ans =
'34' '4'
ans =
'231' '31' '1'
Best Answer