plot.m
上传用户:haiyisale
上传日期:2013-01-09
资源大小:3246k
文件大小:20k
源码类别:

波变换

开发平台:

Matlab

  1. function varargout = plot(treeobj,varargin);
  2. %PLOT Plot NTREE object.
  3. %   PLOT(T) plots the NTREE object T.
  4. %   FIG = PLOT(T) returns the handle of the figure which,
  5. %   contains the tree T.
  6. %   PLOT(T,FIG) plots the tree T in the figure FIG which,
  7. %   already contains a tree.
  8. %
  9. %   PLOT is a graphical tree-management utility. The figure
  10. %   that contains the tree is a GUI tool. It lets you change
  11. %   the Node Label to Depth_Position or Index, and Node Action
  12. %   to Split-Merge or Visualize.
  13. %   The default values are Depth_Position and Visualize.
  14. %
  15. %   You can click the nodes to execute the current Node Action.
  16. %
  17. %   After some split or merge actions you can get the new tree
  18. %   using the handle of the figure, which contains this one.
  19. %   You must use the following special syntax:
  20. %       NEWT = PLOT(T,'read',FIG).
  21. %   In fact, the first argument is dummy. Then the most general
  22. %   syntax for this purpose is:
  23. %       NEWT = PLOT(DUMMY,'READ',FIG);
  24. %   where DUMMY is any NTREE object.
  25. %   DUMMY can be the NTREE object constructor name:
  26. %      NEWT = PLOT(ntree,'read',FIG);
  27. %   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96.
  28. %   Last Revision: 21-May-2003.
  29. %   Copyright 1995-2004 The MathWorks, Inc.
  30. %   $Revision: 1.7.4.2 $  $Date: 2004/03/15 22:38:32 $
  31. % Miscelleanous Values.
  32. %----------------------
  33. line_color = [1 1 1];
  34. actColor   = 'y';
  35. inactColor = 'r';
  36. % MemBloc of stored values.
  37. %--------------------------
  38. n_stored_val = 'NTREE_Plot';
  39. ind_tree     = 1;
  40. ind_Class    = 2;
  41. ind_hdls_txt = 3;
  42. ind_hdls_lin = 4;
  43. ind_menu_NodeLab =  5;
  44. ind_type_NodeLab =  6;
  45. ind_menu_NodeAct =  7;
  46. ind_type_NodeAct =  8;
  47. ind_menu_TreeAct =  9;
  48. ind_type_TreeAct = 10;
  49. nb1_stored = 10;
  50. %----------------------------
  51. % User oriented Memory Block.
  52. % For overloading methods.
  53. %----------------------------
  54. n_toolMemB = 'OverLoad_MB';
  55. % Initialization.
  56. %----------------
  57. objClass = 'ntree';
  58. fig_tree = NaN;
  59. nbin = length(varargin);
  60. switch nbin
  61.   case 0 , option = 'create';
  62.   case 1 ,
  63.     option = varargin{1};
  64.     if isnumeric(option)
  65.        child = allchild(0);
  66.        if ismember(option,child)
  67.            dummy = wmemtool('rmb',option,n_stored_val,ind_type_NodeLab);
  68.            if ~isempty(dummy) , fig_tree = option; end
  69.            option = 'create';
  70.        end
  71.     else
  72.        objClass = option;
  73.        option = 'create';
  74.     end
  75.   otherwise , option = varargin{1}; fig_tree = varargin{2};
  76. end
  77. switch option
  78.   case 'create'
  79.   case {'setNodeLabel','addNodeLabel', ...
  80.         'setNodeAction','addNodeAction','exeNodeAction', ...
  81.         'setTreeAction','addTreeAction', ...
  82.         'Split-Merge', ...
  83.         'getNode','read','write','close',...
  84.         'storeValue','getValue'}
  85.      fig_tree = varargin{2};
  86.   otherwise
  87.     if ischar(option)
  88.       objClass = option;
  89.     else
  90.       option = 'create';
  91.     end
  92.     option = 'create';
  93. end
  94. switch option
  95.   case 'create'
  96.     order = treeord(treeobj);
  97.     depth = treedpth(treeobj);
  98.     allN  = allnodes(treeobj);
  99.     NBnod = nbmaxn(order,depth);
  100.     table_node = -ones(1,NBnod);
  101.     table_node(allN+1) = allN;
  102.     [xnpos,ynpos] = xynodpos(table_node,order,depth);
  103.     if isnan(fig_tree)
  104.         menu_bar = get(0,'DefaultFigureMenuBar');
  105.         fig_tree = colordef('new','black');
  106.         set(fig_tree, ...
  107.             'menubar',menu_bar,   ...
  108.             'Units','normalized', ...
  109.             'HandleVisibility','Callback',...
  110.             'Interruptible','on'  ...
  111.             );
  112.         str_numf = sprintf('%20.15f',fig_tree);
  113.         m_lab = uimenu(fig_tree,'Label','Node Label  ');
  114.         m(1)  = uimenu(m_lab,'Label','Depth_Position','Checked','On');
  115.         m(2)  = uimenu(m_lab,'Label','Index');
  116.         cb_beg = ['plot(ntree,''setNodeLabel'','];
  117.         cb_m1  = [cb_beg , str_numf ',''Depth_Position'');'];
  118.         cb_m2  = [cb_beg , str_numf ',''Index'');'];
  119.         set(m(1),'Callback',cb_m1);
  120.         set(m(2),'Callback',cb_m2);
  121.         wmemtool('ini',fig_tree,n_stored_val,nb1_stored);
  122.         type_NodeLab = 'Depth_Position';
  123.         type_NodeAct = 'Split-Merge';
  124.     else
  125.         str_numf = sprintf('%20.15f',fig_tree);
  126.         delete(findobj(fig_tree,'type','axes'));
  127.         [m_lab,type_NodeLab,type_NodeAct] = ...
  128.             wmemtool('rmb',fig_tree,n_stored_val,...
  129.                            ind_menu_NodeLab,ind_type_NodeLab,ind_type_NodeAct);
  130.     end
  131.     if (nbin<1) | isequal(objClass,'ntree')
  132.         pos_axe_tree = [0.05 0.08 0.90 0.84];
  133.     else
  134.         pos_axe_tree = [0.05 0.08 0.40 0.84];
  135.     end
  136.     axe_tree_lin = axes(...
  137.                     'Parent',fig_tree,               ...
  138.                     'Visible','on',                  ...
  139.                     'XLim',[-0.5,0.5],               ...
  140.                     'YDir','reverse',                ...
  141.                     'YLim',[0 1],                    ...
  142.                     'Units','normalized',            ...
  143.                     'Position',pos_axe_tree,         ...
  144.                     'XTicklabelMode','manual',       ...
  145.                     'YTicklabelMode','manual',       ...
  146.                     'XTickLabel',[],'YTickLabel',[], ...
  147.                     'XTick',[],'YTick',[],           ...
  148.                     'Box','On'                       ...
  149.                     );
  150. wtitle('Tree Decomposition','Parent',axe_tree_lin);
  151.     hdls_lin = zeros(1,NBnod);
  152.     hdls_txt = zeros(1,NBnod);
  153.     i_fath  = 1;
  154.     i_child = i_fath+[1:order];
  155.     for d=1:depth
  156.         ynT = ynpos(d,:);
  157.         ynL = ynT+[0.01 -0.01];
  158.         for p=0:order^(d-1)-1
  159.             if table_node(i_child(1)) ~= -1
  160.                 for k=1:order
  161.                     ic = i_child(k);
  162.                     hdls_lin(ic) = line(...
  163.                         'Parent',axe_tree_lin, ...
  164.                         'XData',[xnpos(i_fath) xnpos(ic)],...
  165.                         'YData',ynL,...
  166.                         'Color',line_color);
  167.                 end
  168.             end
  169.             i_child = i_child+order;
  170.             i_fath  = i_fath+1;
  171.         end
  172.     end
  173.     labels = tlabels(treeobj,'dp');
  174.     textProp = {...
  175.         'Parent',axe_tree_lin,          ...
  176.         'FontWeight','bold',            ...
  177.         'Color',actColor,               ...
  178.         'HorizontalAlignment','center', ...
  179.         'VerticalAlignment','middle',   ...
  180.         'Clipping','on'                 ...
  181.         };    
  182.     
  183.     i_node = 1;   
  184.     hdls_txt(i_node) = ...
  185.         text(textProp{:},...
  186.              'String', labels(i_node,:),   ...
  187.              'Position',[0 0.1 0],         ...
  188.              'UserData',table_node(i_node) ...
  189.              );
  190.     i_node = i_node+1;
  191.     
  192.     i_fath  = 1;
  193.     i_child = i_fath+[1:order];
  194.     for d=1:depth
  195.         for p=0:order:order^d-1
  196.             if table_node(i_child(1)) ~= -1
  197.                 p_child = p+[0:order-1];
  198.                 for k=1:order
  199.                     ic = i_child(k);
  200.                     hdls_txt(ic) = text(...
  201.                                       textProp{:},...
  202.                                       'String',labels(i_node,:), ...
  203.                                       'Position',[xnpos(ic) ynpos(d,2) 0],...
  204.                                       'Userdata',table_node(ic)...
  205.                                       );
  206.                     i_node = i_node+1;
  207.                 end
  208.             end
  209.             i_child = i_child+order;
  210.         end
  211.     end
  212.     btndown_fcn = ['plot(ntree,''Split-Merge'',' str_numf ');'];
  213.     set(hdls_txt(find(hdls_txt)),'ButtonDownFcn',btndown_fcn);
  214.     
  215.     wmemtool('wmb',fig_tree,n_stored_val, ...
  216.                    ind_tree,treeobj,      ...
  217.                    ind_hdls_txt,hdls_txt, ...
  218.                    ind_hdls_lin,hdls_lin, ...
  219.                    ind_menu_NodeLab,m_lab, ...
  220.                    ind_type_NodeLab,'Depth_Position', ...
  221.                    ind_type_NodeAct,'Split-Merge' ...
  222.                    );
  223.     [nul,notAct] = findactn(treeobj,allN,'na');
  224.     set(hdls_txt(notAct+1),'Color',inactColor);
  225.     switch type_NodeLab
  226.       case 'Depth_Position'
  227.       case 'Index' , plot(treeobj,'setNodeLabel',fig_tree,type_NodeLab);
  228.       otherwise
  229.         plot(treeobj,'setNodeLabel',fig_tree,'Depth_Position');
  230.     end
  231.     switch type_NodeAct
  232.       case 'Split-Merge'
  233.       otherwise
  234.         plot(treeobj,'setNodeAction',fig_tree,'Split-Merge');
  235.     end
  236.     set(fig_tree,'Visible','on')
  237.     if nargout>0 , varargout{1} = fig_tree; end
  238.   case 'setNodeLabel'
  239.     NodeLabType = varargin{3};
  240.     m_lab = wmemtool('rmb',fig_tree,n_stored_val,ind_menu_NodeLab);
  241.     if ~isempty(m_lab)
  242.           m = findobj(m_lab,'type','uimenu');
  243.           lstItems = get(m,'label');
  244.           idx_menu = strmatch(NodeLabType,lstItems);
  245.           if isempty(idx_menu) , return; end
  246.           type_lab = wmemtool('rmb',fig_tree,n_stored_val,ind_type_NodeLab);
  247.           if isequal(type_lab,NodeLabType), return; end
  248.           set(m,'Checked','off');
  249.           set(m(idx_menu),'Checked','on');
  250.     end
  251.     wmemtool('wmb',fig_tree,n_stored_val,ind_type_NodeLab,NodeLabType);
  252.     t = wmemtool('rmb',fig_tree,n_stored_val,ind_tree);
  253.     switch NodeLabType
  254.       case {'Depth_Position','Index'} , 
  255.         if isequal(NodeLabType,'Depth_Position')
  256.             labtype = 'dp';
  257.         else
  258.             labtype = 'i';
  259.         end
  260.         labels = tlabels(t,labtype);
  261.       otherwise
  262.         [labels,err] = plot(t,NodeLabType,fig_tree);
  263.         if err , return; end
  264.     end
  265.     hdls_txt = wmemtool('rmb',fig_tree,n_stored_val,ind_hdls_txt);
  266.     hdls_txt = hdls_txt(hdls_txt~=0);
  267.     for k=1:length(hdls_txt), set(hdls_txt(k),'String',labels(k,:)); end
  268.   case 'addNodeLabel'
  269.     NodeLabType = varargin{3};
  270.     m_lab = wmemtool('rmb',fig_tree,n_stored_val,ind_menu_NodeLab);
  271.     m = findobj(m_lab,'type','uimenu');
  272.     lstItems = get(m,'label');
  273.     idx_menu = strmatch(NodeLabType,lstItems);
  274.     if ~isempty(idx_menu) , varargout{1} = m(idx_menu);return; end
  275.     m_add  = uimenu(m_lab,'Label',NodeLabType);
  276.     cb_add = ['plot(ntree,''setNodeLabel'',' , num2str(fig_tree) , ...
  277.               ',''' NodeLabType ''');'];
  278.     set(m_add,'Callback',cb_add);
  279.     varargout{1} = m_add;
  280.   case 'setNodeAction'
  281.     NodeActType = varargin{3};
  282.     m_act = wmemtool('rmb',fig_tree,n_stored_val,ind_menu_NodeAct);
  283.     if ~isempty(m_act)
  284.         m = findobj(m_act,'type','uimenu');
  285.         lstItems = get(m,'label');
  286.         idx_menu = strmatch(NodeActType,lstItems);
  287.         type_act = wmemtool('rmb',fig_tree,n_stored_val,ind_type_NodeAct);
  288.         if isequal(type_act,NodeActType), return; end
  289.         set(m,'Checked','off');
  290.         set(m(idx_menu),'Checked','on');
  291.     end
  292.     str_numf = sprintf('%20.15f',fig_tree);
  293.     wmemtool('wmb',fig_tree,n_stored_val,ind_type_NodeAct,NodeActType);
  294.     switch NodeActType
  295.       case 'Split-Merge'       
  296.         nodeAction = ['plot(ntree,''Split-Merge'',' str_numf ');'];
  297.       otherwise
  298.         nodeAction = ['plot(ntree,''exeNodeAction'',' str_numf ...
  299.                       ',''' NodeActType ''');'];
  300.     end
  301.     hdls_txt = wmemtool('rmb',fig_tree,n_stored_val,ind_hdls_txt);
  302.     hdls_txt = hdls_txt(hdls_txt~=0);
  303.     set(hdls_txt(ishandle(hdls_txt)),'ButtonDownFcn',nodeAction);
  304.   case 'addNodeAction'
  305.     NodeActType = varargin{3};
  306.     m_act = wmemtool('rmb',fig_tree,n_stored_val,ind_menu_NodeAct);
  307.     if isempty(m_act)
  308.         m_act = uimenu(fig_tree,'Label','Node Action  ');
  309.         wmemtool('wmb',fig_tree,n_stored_val,ind_menu_NodeAct,m_act);
  310.     else
  311.         m = findobj(m_act,'type','uimenu');
  312.         lstItems = get(m,'label');
  313.         idx_menu = strmatch(NodeActType,lstItems);
  314.         if ~isempty(idx_menu)
  315.             varargout{1} = m(idx_menu);
  316.             return;
  317.         end
  318.     end
  319.     m_add  = uimenu(m_act,'Label',NodeActType);
  320.     cb_add = ['plot(ntree ,''setNodeAction'',' , num2str(fig_tree) , ...
  321.               ',''' NodeActType ''');'];
  322.     set(m_add,'Callback',cb_add);
  323.     varargout{1} = m_add;
  324.   case 'exeNodeAction'
  325.     NodeActType = varargin{3};
  326.     t = wmemtool('rmb',fig_tree,n_stored_val,ind_tree);
  327.     plot(t,NodeActType,fig_tree);
  328.   case 'setTreeAction'
  329.     TreeActType = varargin{3};
  330.     m_tree = wmemtool('rmb',fig_tree,n_stored_val,ind_menu_TreeAct);
  331.     m = findobj(m_tree,'type','uimenu');
  332.     lstItems = get(m,'label');
  333.     idx_menu = strmatch(TreeActType,lstItems);
  334.     if isempty(idx_menu) , return; end
  335.     % type_act = wmemtool('rmb',fig_tree,n_stored_val,ind_type_TreeAct);
  336.     % if isequal(type_act,TreeActType), return; end
  337.     wmemtool('wmb',fig_tree,n_stored_val,ind_type_TreeAct,TreeActType);
  338.     set(m,'Checked','off');
  339.     set(m(idx_menu),'Checked','on');
  340.     t = wmemtool('rmb',fig_tree,n_stored_val,ind_tree);
  341.     plot(t,TreeActType,fig_tree);
  342.   case 'addTreeAction'
  343.     TreeActType = varargin{3};
  344.     m_tree = wmemtool('rmb',fig_tree,n_stored_val,ind_menu_TreeAct);
  345.     if isempty(m_tree)
  346.         m_tree = uimenu(fig_tree,'Label','Tree Action  ');
  347.         wmemtool('wmb',fig_tree,n_stored_val,ind_menu_TreeAct,m_tree);
  348.     else
  349.         m = findobj(m_tree,'type','uimenu');
  350.         lstItems = get(m,'label');
  351.         idx_menu = strmatch(TreeActType,lstItems);
  352.         if ~isempty(idx_menu)
  353.             varargout{1} = m(idx_menu);
  354.             return;
  355.         end
  356.     end
  357.     m_add  = uimenu(m_tree,'Label',TreeActType);
  358.     cb_add = ['plot(ntree ,''setTreeAction'',' , num2str(fig_tree) , ...
  359.               ',''' TreeActType ''');'];
  360.     set(m_add,'Callback',cb_add);
  361.     varargout{1} = m_add;
  362.   case 'Split-Merge'
  363.     node = plot(ntree,'getNode',fig_tree);
  364.     if isempty(node) , return; end
  365.     % Get stored values.
  366.     %-------------------
  367.     [treeobj,hdls_txt,hdls_lin,type_lab]  = ...
  368.         wmemtool('rmb',fig_tree,n_stored_val, ...
  369.                        ind_tree,     ...
  370.                        ind_hdls_txt, ...
  371.                        ind_hdls_lin, ...
  372.                        ind_type_NodeLab  ...
  373.                        );
  374.     % Decomposition/recomposition.
  375.     %-----------------------------
  376.     [n_rank,node] = findactn(treeobj,node,'a');
  377.     if isempty(n_rank), return; end
  378.     order = treeord(treeobj);
  379.     if order==0 , return; end
  380.     mousefrm(fig_tree,'watch')
  381.     if n_rank==0
  382.         treeobj = nodejoin(treeobj,node);
  383.     else
  384.         treeobj = nodesplt(treeobj,node);
  385.     end
  386.     wmemtool('wmb',fig_tree,n_stored_val,ind_tree,treeobj);
  387.     depth = treedpth(treeobj);
  388.     allN  = allnodes(treeobj);
  389.     NBnod = nbmaxn(order,depth);
  390.     table_node = -ones(1,NBnod);
  391.     table_node(allN+1) = allN;
  392.     [xnpos,ynpos] = xynodpos(table_node,order,depth);
  393.     % Drawing New Tree.
  394.     %------------------
  395.     axe_tree_lin = get(hdls_txt(1),'Parent');
  396.     axes(axe_tree_lin);
  397.     btndown_fcn = get(hdls_txt(1),'ButtonDownFcn');
  398.  
  399.     % Create the new tree.
  400.     %---------------------
  401.     node  = depo2ind(order,node);
  402.     [d,b] = ind2depo(order,node);
  403.     % Suppress the descendants of the node.
  404.     %--------------------------------------
  405.     if n_rank==0
  406.         if NBnod < size(hdls_txt,2)
  407.             to_del = find(hdls_txt(NBnod+1:size(hdls_txt,2)))+NBnod;
  408.             delete([hdls_txt(to_del) hdls_lin(to_del)]);
  409.             hdls_txt = hdls_txt(1:NBnod);
  410.             hdls_lin = hdls_lin(1:NBnod);
  411.         end
  412.         K = find((table_node==-1) & (hdls_txt ~= 0));
  413.         K = K(K>1);
  414.         delete([hdls_txt(K) hdls_lin(K)]);
  415.         hdls_txt(K) = 0;
  416.         hdls_lin(K) = 0;
  417.  
  418.     % Create the descendants of the node.
  419.     %------------------------------------
  420.     else
  421.         Tree_Colors = wtbxappdata('get',fig_tree,'Tree_Colors');
  422.         if ~isempty(Tree_Colors)
  423.             line_color = Tree_Colors.line_color;
  424.             actColor   = Tree_Colors.actColor;
  425.             inactColor = Tree_Colors.inactColor;
  426.         end
  427.         i_fath  = node+1;
  428.         child   = node*order+[1:order]';
  429.         i_child = child+1;
  430.         if NBnod > size(hdls_lin,2)
  431.             hdls_txt = [hdls_txt zeros(1,NBnod-size(hdls_txt,2))];
  432.             hdls_lin = [hdls_lin zeros(1,NBnod-size(hdls_lin,2))];
  433.         end
  434.         for k=1:order
  435.             ic = i_child(k);
  436.             ynT = ynpos(d+1,:);
  437.             ynL = ynT+[0.01 -0.01];
  438.             hdls_lin(ic) = ...
  439.                     line(...
  440.                          'XData',[xnpos(i_fath) xnpos(ic)],...
  441.                          'YData',ynL, ...
  442.                          'Color',line_color,     ...
  443.                          'Userdata',[i_fath ic]  ...
  444.                          );
  445.         end        
  446.         switch type_lab
  447.           case 'Depth_Position' , labels = tlabels(treeobj,'dp',child);
  448.           case 'Index'          , labels = tlabels(treeobj,'i',child);
  449.           otherwise
  450.             [labels,err] = plot(treeobj,type_lab,fig_tree,child);
  451.             if err , return; end
  452.         end
  453.         for k=1:order
  454.             ic = i_child(k);
  455.             hdls_txt(ic) = text(...
  456.                     'Clipping','on',                       ...
  457.                     'String',labels(k,:),                  ...
  458.                     'Position',[xnpos(ic) ynpos(d+1,2) 0], ...
  459.                     'HorizontalAlignment','center',        ...
  460.                     'VerticalAlignment','middle',          ...
  461.                     'Color',actColor,                      ...
  462.                     'FontWeight','bold',                   ...
  463.                     'Userdata',table_node(ic),             ...
  464.                     'ButtonDownFcn',btndown_fcn            ...
  465.                     );
  466.         end
  467.         [nul,notAct] = findactn(treeobj,child,'na');
  468.         set(hdls_txt(notAct+1),'Color',inactColor);
  469.     end
  470.     % Plot the new tree.
  471.     %-------------------
  472.     i_fath = 1;
  473.     i_child = i_fath+[1:order];
  474.     for d=1:depth
  475.         ynT = ynpos(d,:);
  476.         ynL = ynT+[0.01 -0.01];
  477.         for p=0:order^(d-1)-1
  478.             if table_node(i_child(1)) ~= -1
  479.                 for k=1:order
  480.                     ic = i_child(k);
  481.                     set(hdls_txt(ic),'Position',[xnpos(ic) ynT(2) 0]);
  482.                     set(hdls_lin(ic),...
  483.                     'XData',[xnpos(i_fath) xnpos(ic)], ...
  484.                     'YData',ynL);
  485.                 end
  486.             end
  487.             i_child = i_child+order;
  488.             i_fath  = i_fath+1;
  489.         end
  490.     end
  491.     wmemtool('wmb',fig_tree,n_stored_val, ...
  492.                    ind_hdls_txt,hdls_txt, ...
  493.                    ind_hdls_lin,hdls_lin  ...
  494.                    );
  495.     mousefrm(fig_tree,'arrow')
  496.   case 'getNode'
  497.     varargout{1} = [];
  498.     obj = get(fig_tree,'CurrentObject');
  499.     if ~isempty(obj)
  500.         hdls_txt = wmemtool('rmb',fig_tree,n_stored_val,ind_hdls_txt);
  501.         axe_tree_lin = get(hdls_txt(1),'Parent');
  502.         if isequal(get(obj,'Parent'),axe_tree_lin)
  503.            varargout{1} = get(obj,'UserData');
  504.         end
  505.     end
  506.   case 'read'
  507.     varargout{1} = wmemtool('rmb',fig_tree,n_stored_val,ind_tree);
  508.   case 'write'
  509.     varargout{1} = wmemtool('wmb',fig_tree,n_stored_val,...
  510.                       ind_tree,varargin{3},ind_Class,class(varargin{3}));
  511.   case 'storeValue'
  512.     % varargin{3} = name
  513.     % varargin{4} = value
  514.     %--------------------                       
  515.     memB = wmemtool('rmb',fig_tree,n_toolMemB,1);
  516.     memB.(varargin{3}) = varargin{4};
  517.     wmemtool('wmb',fig_tree,n_toolMemB,1,memB);
  518.     if nargout>0 , varargout = {memB}; end
  519.   case 'getValue'
  520.     % varargin{3} = name
  521.     %--------------------
  522.     memB = wmemtool('rmb',fig_tree,n_toolMemB,1);
  523.     try   , varargout{1} = memB.(varargin{3});
  524.     catch , varargout{1} = [];
  525.     end
  526.   case 'close'
  527.     close(fig_tree)
  528. end
  529. %=============================================================================%
  530. % INTERNAL FUNCTIONS
  531. %=============================================================================%
  532. %-----------------------------------------------------------------------------%
  533. function nb = nbmaxn(order,depth);
  534. switch order
  535.   case 1    , nb = depth+1;
  536.   otherwise , nb = (order^(depth+1)-1)/(order-1);
  537. end
  538. %-----------------------------------------------------------------------------%
  539. %=============================================================================%