Filter a cell array with words

조회 수: 1 (최근 30일)
AA
AA 2019년 7월 28일
답변: Walter Roberson 2019년 7월 28일
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
Walter Roberson
Walter Roberson 2019년 7월 28일
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 2019년 7월 28일
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 "-".

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2019년 7월 28일
trimedcell = regexprep(YourCellArray, '-.*', '', 'once');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by