function disp_tree(T,A,B) % DISP_TREE displays the decision tree generated by the MSMT algorithm % by creating a graph of the tree and displaying the w,theta info % for each non-leaf node in the MATLAB environment % % disp_tree(T,A,B) % % T: matrix representing the decision tree % A: matrix representing the point set A % B: matrix representing the point set B global count; count = 1; % determine the depth of the tree: [m,num_nodes] = size(T); n = m - 4; depth = 0; for i = 1:num_nodes if (T(n+4,i) > depth) depth = T(n+4,i); end end % determine the size of the graph xmax = 2^(depth-1); xmin = 0; ymax = depth + 2; ymin = 0; % open a plotting window figure; % turn the axis off axis('off'); % set the axis axis([ xmin xmax ymin ymax ]); % hold these axis hold on; % determine the graph dummy = []; ystart = ymax - 1; draw_tree(T,xmin,xmax,ystart,1); % the graph is drawn % nodes are numbered in depth-first fashion % Now determine the breakdown matrix: Tb = []; Tb = msmt_tree_breakdown(Tb,T,A,B,1); % now print out the pertinent information about the non-leaf nodes % print out the header disp(blanks(5)') disp(['Plane: wx = theta']) disp(blanks(1)') disp(['Node # ' ' ' ' ' 'w' blanks(8*n+1) 'theta ' ' ' '# Pts. of A' ' ' '# Pts. of B' ]) count = 1; disp(blanks(1)') output_tree(T,Tb,1);