Group string based on charachter

Hi all If i have a string lets say a='1/23s' is there a way to take 1 and 23s seperately on some other variables so i can then extract only the numbers from them.

 Akzeptierte Antwort

Chandra Kurniawan
Chandra Kurniawan am 7 Dez. 2011

2 Stimmen

a='1/23s';
i = findstr(a,'/')
b = a(1:i-1)
c = a(i+1:end)

Weitere Antworten (1)

Andrei Bobrov
Andrei Bobrov am 7 Dez. 2011

1 Stimme

str2double(regexp(a,'\d+','match'))
and
regexp(a,'/','split')

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by