Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions @tree/find.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
% I = FIND(T,K,'last') returns at most the last K indices corresponding
% to the nonzero entries of the tree T.
%
obj.Node(cellfun(@isempty, obj.Node)) = {false};
val = [ obj.Node{:} ] ;
I = find(val, varargin{:});
end
11 changes: 11 additions & 0 deletions @tree/findbranchpoints.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function indices = findbranchpoints(obj, varargin)
%FIND Find indices of nodes with more than one child.
% I = FINDBRANCHPOINTS(T) returns the linear indices corresponding to the
% nonzero entries of the tree T.

indices = find( ...
arrayfun(@(x) numel(obj.getchildren(x)), ...
obj.nodeorderiterator(), ...
'UniformOutput', true) > 1);

end