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

 採用された回答

Jan
Jan 2017 年 8 月 30 日

0 投票

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)

1 件のコメント

Mehdi Sari
Mehdi Sari 2017 年 8 月 30 日
Perfect, thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

タグ

質問済み:

2017 年 8 月 30 日

コメント済み:

2017 年 8 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by