Find the string from the cell array

1 次查看(过去 30 天)
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 中查找有关 Cell Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by