"Stefan" wrote in message <firstname.lastname@example.org>... > Hey Yall, > > I want to find a value within a structure, i know I can find it with a for loop but that seems to be insufficient. Example: > > The structure is called tree with field c containing the coordinates of an edge and c varies in length depending on the length of the edge! Value is a double and the value to find. > > I cant figure out, how to do this with structfun > > structfun(@find, tree.c, value) or > structfun(@x, find(value == x), tree.c) > does not work > > Anyone a solution for my problem? > > Thanks in advance! > > Stefan
read the help of structfun, it applies your function to each field of the structure what about find(abs(tree.c-val)<tol)) ?