GETNODES_PLOT converts a history object to a nodes structure suitable for plotting as a tree. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: GETNODES_PLOT converts a history object to a nodes structure suitable for plotting as a tree. CALL: [n,a, nodes] = getNodes_plot(hist, [], 0, 1, [], 0, 2); OUTPUT: n: A vector of parent pointers a: Number of nodes nodes: Struct of the nodes REMARK: This version is equivalent to getNodes with the different that this function only return the nodes up to the MAX_DEPTH. M-FILE INFO: Get information about this methods by calling >> history.getInfo('getNodes_plot') Get information about a specified set-plist by calling: >> history.getInfo('getNodes_plot', 'set') VERSION: $Id: getNodes_plot.m,v 1.9 2008/09/04 15:29:30 ingo Exp $ HISTORY: 14-06-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % GETNODES_PLOT converts a history object to a nodes structure suitable for plotting as a tree. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: GETNODES_PLOT converts a history object to a nodes structure 0005 % suitable for plotting as a tree. 0006 % 0007 % CALL: [n,a, nodes] = getNodes_plot(hist, [], 0, 1, [], 0, 2); 0008 % 0009 % OUTPUT: n: A vector of parent pointers 0010 % a: Number of nodes 0011 % nodes: Struct of the nodes 0012 % 0013 % REMARK: This version is equivalent to getNodes with the different that 0014 % this function only return the nodes up to the MAX_DEPTH. 0015 % 0016 % M-FILE INFO: Get information about this methods by calling 0017 % >> history.getInfo('getNodes_plot') 0018 % 0019 % Get information about a specified set-plist by calling: 0020 % >> history.getInfo('getNodes_plot', 'set') 0021 % 0022 % VERSION: $Id: getNodes_plot.m,v 1.9 2008/09/04 15:29:30 ingo Exp $ 0023 % 0024 % HISTORY: 14-06-07 M Hewitson 0025 % Creation 0026 % 0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0028 0029 function [varargout] = getNodes_plot(varargin) 0030 0031 %%% Check if this is a call for parameters 0032 if utils.helper.isinfocall(varargin{:}) 0033 varargout{1} = getInfo(varargin{3}); 0034 return 0035 end 0036 0037 %%% Set inputs 0038 h = varargin{1}; 0039 n = varargin{2}; % list of current node values 0040 pn = varargin{3}; % current node value 0041 a = varargin{4}; % number of nodes 0042 nodes = varargin{5}; 0043 depth = varargin{6}; 0044 MAX_DEPTH = varargin{7}; 0045 0046 n = [n pn]; 0047 pl = h.plistUsed; 0048 nodes(a).pn = pn; 0049 nodes(a).invars = h.methodInvars; 0050 nodes(a).n = a; 0051 nodes(a).names = h.methodInfo.mname; 0052 nodes(a).params = char(pl); 0053 nodes(a).pl = pl; 0054 nodes(a).h = history(h); 0055 disp(sprintf(' -- scanning node %03d [%s]', a, char(nodes(a).names))); 0056 0057 if depth == MAX_DEPTH 0058 nodes(a).names = '...'; 0059 nodes(a).params = ''; 0060 nodes(a).invars = {}; 0061 end 0062 0063 % set the current node value to the number of the child 0064 pn = a-1; 0065 0066 ih = h.inhists; 0067 0068 % Now decide what to do with my children 0069 if isa(ih, 'history') 0070 for i=1:length(ih) 0071 0072 if depth < MAX_DEPTH 0073 a = a + 1; 0074 [n,a, nodes] = getNodes_plot(ih(i), n, pn+1, a, nodes, depth+1, MAX_DEPTH); 0075 end 0076 end 0077 end 0078 0079 % Set outputs 0080 varargout{1} = n; 0081 varargout{2} = a; 0082 varargout{3} = nodes; 0083 end 0084 0085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0086 % Local Functions % 0087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0088 0089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0090 % 0091 % FUNCTION: getInfo 0092 % 0093 % DESCRIPTION: Get Info Object 0094 % 0095 % HISTORY: 11-07-07 M Hewitson 0096 % Creation. 0097 % 0098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0099 0100 function ii = getInfo(varargin) 0101 if nargin == 1 && strcmpi(varargin{1}, 'None') 0102 sets = {}; 0103 pl = []; 0104 else 0105 sets = {'Default'}; 0106 pl = getDefaultPlist; 0107 end 0108 % Build info object 0109 ii = minfo(mfilename, 'history', '', utils.const.categories.internal, '$Id: getNodes_plot.m,v 1.9 2008/09/04 15:29:30 ingo Exp $', sets, pl); 0110 end 0111 0112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0113 % 0114 % FUNCTION: getDefaultPlist 0115 % 0116 % DESCRIPTION: Get Default Plist 0117 % 0118 % HISTORY: 11-07-07 M Hewitson 0119 % Creation. 0120 % 0121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0122 0123 function plo = getDefaultPlist() 0124 plo = plist(); 0125 end 0126