From: Bruce on 30 Apr 2010 00:05 Say there is an item in a struct, for example tree(1).branch.leaf = 'gold' I want to find all the leaves that are equal to the string, 'gold' Doing it with 2 layer structures is easy. If tree(1).branch = 'gold' then I could just do find(strcmp({tree.branch},'gold')); But it doesn't work for a third layer. If you were to do find(strcmp({tree.branch.leaf},'gold')) you would get an error, "dot name reference on non-scalar structure". Is there a way to do this recursively?
|
Pages: 1 Prev: Return digits of a number as a list Next: simple problem |