iluke_graphs

PURPOSE ^

SYNOPSIS ^

function graph = iluke_graphs(h,n,str,tag,curtime)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function graph = iluke_graphs(h,n,str,tag,curtime)
0002 %
0003 if nargin < 5,
0004     curtime = 0;% case with all times considered
0005 end
0006 if ~iscell(n),
0007     if isscalar(n),
0008         n=1:n;
0009     end
0010     n={n};
0011 end
0012 nn = length(n);
0013 if ~iscell(str),
0014     str = repmat({str},[1,nn]);
0015 end
0016 if ~iscell(tag),
0017     tag = repmat({tag},[1,nn]);
0018 end
0019 %
0020 nlist = [];
0021 for in=1:nn,
0022     nlist = [nlist,n{in}];
0023 end
0024 %
0025 children = get(h,'children');% list of children for plot1
0026 nch = length(children);
0027 %
0028 flag = false(1,nch); 
0029 lflag = false(1,nch); 
0030 %
0031 for ich = 1:nch,
0032     flag(ich) = strcmp(get(children(ich),'Type'),'axes') && strcmp(get(children(ich),'Visible'),'on');
0033     lflag(ich) = strcmp(get(children(ich),'Type'),'legend') && strcmp(get(children(ich),'Visible'),'on');
0034 end
0035 flag = find(flag);
0036 lflag = find(lflag);
0037 nf = length(flag);
0038 nlf = length(lflag);
0039 %
0040 if nlf > 0 % no legend or more recent matver
0041     if length(flag) < nn,
0042         error('Problem identifying graphs');
0043     else
0044         for in = 1:nn,
0045             graph(in).handles(1) = children(flag(n{in}(1)));
0046             for ilf = 1:nlf
0047                 if get(children(lflag(ilf)),'axes') == graph(in).handles(1),
0048                     graph(in).handles(end+1) = children(lflag(ilf));
0049                 end
0050             end
0051             graph(in).info = str{in};
0052             graph(in).tag = tag{in};
0053             graph(in).curtime = curtime;
0054         end
0055     end
0056 else % older matevr
0057     if nf < max(nlist)
0058         error('Problem identifying graphs');
0059     else
0060         for in = 1:nn,
0061             graph(in).handles = children(flag(n{in}));
0062             graph(in).info = str{in};
0063             graph(in).tag = tag{in};
0064             graph(in).curtime = curtime;
0065         end
0066     end
0067 end
0068 %

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.