Group string based on charachter

2 visualizaciones (últimos 30 días)
Raldi
Raldi el 7 de Dic. de 2011
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.

Respuesta aceptada

Chandra Kurniawan
Chandra Kurniawan el 7 de Dic. de 2011
a='1/23s';
i = findstr(a,'/')
b = a(1:i-1)
c = a(i+1:end)

Más respuestas (1)

Andrei Bobrov
Andrei Bobrov el 7 de Dic. de 2011
str2double(regexp(a,'\d+','match'))
and
regexp(a,'/','split')

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by