MATLAB Answers

Delete a row in a structure that contains a certain word

8 views (last 30 days)
AA
AA on 3 Aug 2019
Answered: Walter Roberson on 3 Aug 2019
Hi,
I have a 1×5897 struct array with fields. How do I delete the entire rows that contain the letters 'AA'.

  3 Comments

Walter Roberson
Walter Roberson on 3 Aug 2019
Is the AA to be in one particular field, or in any of the fields? Is the field to match exactly or is the AA to occur anywhere inside a longer string?
AA
AA on 3 Aug 2019
The heading of the column Letters has several letters in that struct array. AA is one of them.
AA
AA on 3 Aug 2019
so if the structure is called Random then you can find the column amongst Random.Letters

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 3 Aug 2019
mask = ismember({Random.Letters}, 'AA') ;
Random(mask) = [] ;

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.