matlab - selecting specific fields in a structure array based on the values of the field. -
i new matlab , appreciate help. have structure "s" , inside "s" have fields 1 of "t" trials , inside "t" have 20 other fields , have values written in 1xn matrices. have 900 trials , want select specific ones based on values of field inside each trial (s.t.a). how can this? bit lost cant figure out should for. thank you.
it unclear me variables are, , matters lot how can operate on them. example, may want structfun problem - allows apply function each field of structure, must scalar, e.g. structfun(@(x) x==180,s.t) return result of ==180 each field of t.
if struct isn't scalar, try logical indexing, e.g. [s.t([s.t.direction]==180)] return struct condition direction == 180 true.
if supply actual variable working you'll more helpful answers.
Comments
Post a Comment