MATLAB: How to filter struct according to strings in field

fieldstruct

I have 1132×1 struct array with fields:
Geometry
BoundingBox
X
Y
STYP
In field STYP can be strings like EC030, EB010, EA040, etc… For me are only important rows (in struct) with string EA030 (in field STYP).

Best Answer

wantedelements = yourstructure(strcmp({yourstructure.STYP}, 'EA030'))
{yourstructure.STYP} concatenate all the STYP fields into a cell array that you can then compare to your string to filter your array.