"James Tursa" wrote in message <firstname.lastname@example.org>... > > Are you asking this question because you want to dynamically pick the fieldname at runtime? E.g., myArr.(fieldnamevariable)
Yes, exactly. Ultimately, I want to be able to select elements of a structure array for which the fields have certain values, e.g. myStruct([myStruct.X]>10). I can do that fine at the command line, but I'm creating some tools for other users who are not as familiar with structures, so I want to give them a user-friendly interface that will work with whatever filtering criteria they want to use.
I suppose I could do this with a big switch block with separate (otherwise identical) cases for each field, but that seems kind of cumbersome. Instead, I'm looping through the structure array and testing the field values one at a time. That always feels wrong in Matlab.