Find the string from the cell array

1 visualización (últimos 30 días)
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan el 12 de Ag. de 2015
Editada: Azzi Abdelmalek el 12 de Ag. de 2015
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

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 12 de Ag. de 2015
Editada: Azzi Abdelmalek el 12 de Ag. de 2015
a = {'s_ddfa_af' ; 'adfa' ; 'f_dsfa_dasf_sdf'; 'asdf_dd'};
out=regexpi(a,'^s\w*','match')

Más respuestas (0)

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by