Filter löschen
Filter löschen

Regular Expressions using regexp

1 Ansicht (letzte 30 Tage)
Priya
Priya am 12 Okt. 2013
Beantwortet: Walter Roberson am 13 Okt. 2013
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".

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 12 Okt. 2013
Bearbeitet: Azzi Abdelmalek am 12 Okt. 2013
a={'-2.4,-3';'2,3';'0,5';'-4,-2.5';'A';'V';'C'}
out=a(cellfun(@(x) ~isempty(strfind(x,',')),a))

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 13 Okt. 2013
regexp(a, '.*,.*', 'match')

Community Treasure Hunt

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

Start Hunting!

Translated by