Regular Expressions using regexp

I have a cell array of strings a = {'-2.4,-3';'2,3';'0,5';'-4,-2.5';'A';'V';'C'}
Now I want to list those strings which have a "comma".

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 10 月 12 日
編集済み: Azzi Abdelmalek 2013 年 10 月 12 日

1 投票

a={'-2.4,-3';'2,3';'0,5';'-4,-2.5';'A';'V';'C'}
out=a(cellfun(@(x) ~isempty(strfind(x,',')),a))

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 10 月 13 日

0 投票

regexp(a, '.*,.*', 'match')

カテゴリ

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

質問済み:

2013 年 10 月 12 日

回答済み:

2013 年 10 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by