matlab-tree icon indicating copy to clipboard operation
matlab-tree copied to clipboard

Potential bug fix for a corner case in find() and additional method

Open aarpon opened this issue 6 years ago • 0 comments

Hi! I have been using your great @tree class for a while and I recently committed a small fix and new commodity method. (Sorry that I put them in the same pull request). Please feel free to keep or reject as you wish.

Bug fix in @tree/find

If a tree contains empty values in the Node property, the following will fail:

find(myTree == value)

since

val = [ obj.Node{:} ] ;

in @tree/find will cause the empty values to be dropped. The val array will be shorter than the original obj.Node array and the subsequent

I = find(val, varargin{:});

call will return indices that are not pointing to the correct values in the tree.

Commodity method @tree/findbranchpoints

A while ago I added a @tree/findbranchpoints method that comes in handy when you want to spot all branch points in the tree.

aarpon avatar Apr 09 '18 16:04 aarpon