To print a tree with '#' in Matlab, you can use the treeplot function. The treeplot function takes 1 argument which is a vector of parent nodes. The following is an example code:
main.m28 chars3 lines
This code will generate a tree with a root node at 1, with child nodes at 2, 3 and 4. To replace the nodes with '#' symbol, you can use set function to set the marker property of the plotted nodes. The following is an example code that replaces the nodes with '#' symbol.
main.m194 chars8 lines
This code uses the treeplot function to plot the tree and then assigns the Marker property of the plotted nodes to 'o', with MarkerFaceColor set to 'k' (black color) and MarkerSize set to 8. Finally the code uses the text function to add '#' symbols to each of the nodes. The output of this code will be a tree with '#' symbols instead of nodes.
gistlibby LogSnag