Filter a cell array with words

1 Ansicht (letzte 30 Tage)
AA
AA am 28 Jul. 2019
Beantwortet: Walter Roberson am 28 Jul. 2019
Hi,
assume you have the cell array{1,1} with a text called "XXXX-adsaads". I want the the portion -adsaads to be removed so that I only get XXXX. How can I do this?
  2 Kommentare
Walter Roberson
Walter Roberson am 28 Jul. 2019
Is the "adsaads" known ahead of time? Or are you wanting to find the part before the first - ? or are you wanting to find the part before the last - in cases where there are multiple - ?
AA
AA am 28 Jul. 2019
the only thing that is known is that a four or three lettered wording comes before the "-" and after the "-" more words are coming. i want to FILTER out everything that comes after the "-".

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 28 Jul. 2019
trimedcell = regexprep(YourCellArray, '-.*', '', 'once');

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by