Find the string from the cell array

조회 수: 2 (최근 30일)
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan 2015년 8월 12일
편집: Azzi Abdelmalek 2015년 8월 12일
I have a cell array containg a = {'s_ddfa_af' ; 'adfa' ; 'f_dsfa_dasf_sdf'; 'asdf_dd'};
I need to extract the string starting with 's'
When I use regular expression regexpi( a , 's(\w*)' ,'match')
I am getting as {'s_ddfa_af' ; [] ; 'sfa_dasf_sdf' ; 'sdf_dd'}
but i need only the string starting with 's'
How can i do this??
Thanks a lot

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 8월 12일
편집: Azzi Abdelmalek 2015년 8월 12일
a = {'s_ddfa_af' ; 'adfa' ; 'f_dsfa_dasf_sdf'; 'asdf_dd'};
out=regexpi(a,'^s\w*','match')

추가 답변 (0개)

카테고리

Help CenterFile 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