Find certain cells with keyword

Hello Imagine I have a matrix containing a column of files name,like this: wte-142-9 wte-111-1 wte-142-1 wte-123-09 wte-142-6
I want to use some scripts to help me just extract for example cell with common keyword '142' and the output will be: wte-142-9 wte-142-1 wte-142-6 Thank you

 Respuesta aceptada

Jan
Jan el 30 de Ag. de 2017
S = {'wte-142-9', 'wte-111-1', 'wte-142-1', 'wte-123-09', 'wte-142-6'};
M = S(contains(S, '-142-')) % With modern Matlab versions
For older systems:
match = ~cellfun('isempty', strfind(S, '-142-'));
M = S(match)

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 30 de Ag. de 2017

Comentada:

el 30 de Ag. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by