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.

 채택된 답변

Chandra Kurniawan
Chandra Kurniawan 2011년 12월 7일

2 개 추천

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

추가 답변 (1개)

Andrei Bobrov
Andrei Bobrov 2011년 12월 7일

1 개 추천

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

카테고리

도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by