MATLAB Answers


Delete a row in a structure that contains a certain word

Asked by AA
on 3 Aug 2019
Latest activity Answered by Walter Roberson
on 3 Aug 2019
I have a 1×5897 struct array with fields. How do I delete the entire rows that contain the letters 'AA'.


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?
The heading of the column Letters has several letters in that struct array. AA is one of them.
so if the structure is called Random then you can find the column amongst Random.Letters

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 3 Aug 2019
 Accepted Answer

mask = ismember({Random.Letters}, 'AA') ;
Random(mask) = [] ;


Sign in to comment.