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

 Réponse acceptée

Jan
Jan le 30 Août 2017

0 votes

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)

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by