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

 Akzeptierte Antwort

Jan
Jan am 30 Aug. 2017

0 Stimmen

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)

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 30 Aug. 2017

Kommentiert:

am 30 Aug. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by