"Bruce Elliott" <email@example.com> wrote in message <firstname.lastname@example.org>... > Is there any way to use getfield() on an array of structure and to get a same-sized array of field values? > > In other words, I can do this: > > x = [myArr.F]; > > to get an array with the values in the field F in my stuct array, myArr. > > This, however, does not work: > > x = getfield(myArr,'F'); > > (Putting  around anything on the right-hand-side does not help.) > > There's probably a good reason for this, but the documentation suggests that x = getfield(S,'F') is equivalent to x = S.F, so I would have hoped that I could do this.
Are you asking this question because you want to dynamically pick the fieldname at runtime? E.g., myArr.(fieldnamevariable)