www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdevmlerf/ShowTestNum.m
function txt= ShowTestNum(mdev,ax,~,X,~) %SHOWTESTNUM show test numbers in axes % % txt= ShowTestNum(mdev,ax,NoOutliers,X,Y); % txt= ShowTestNum(mdev,ax); % The test numbers will be drawn adjacent to the points in the line with % tag 'main line' in ax % Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc. lh=findobj(ax,'Tag','main line'); tnvis= get(ax,'Visible'); lh=lh(1); xdata=get(lh,'XData'); ydata=get(lh,'YData'); if nargin<4 X= getdata(mdev,'FIT'); end if iscell(X) % X = {Xloc,Xglob} Xloc has our local factors for all sweeps % X = {Xglob} the sweepset of sweep means Xloc= X{1}; X= X{end}; else % just one sweepset Xloc= X; end tn= testnum(X); if length(xdata)==size(Xloc,1) && size(Xloc,3)==length(tn) % probably doing one-stage model with sweep data ts= tsizes(Xloc); t= cell(length(tn),1); for i=1:length(tn) t{i}= tn(i)*ones(ts(i),1); end tn= cat(1,t{:}); % all test number text is black cols= num2cell(zeros(length(tn),3),2); else % mle diagnostic plots uses predmode==0 [X,~,dOk]= FitData(mdev); tn= testnum(X); p= Parent(mdev); [~,cols]= SweepNotes(p.info); if length(tn)~=length(xdata) tn=tn(dOk); end if length(cols)~=length(xdata) cols= cols(dOk); end if length(cols)~=length(xdata) % make all colour black cols= repmat({[0 0 0]},1,length(xdata)); end end txt= gobjects(length(tn),1); tstr= mbcnum2str(tn,20,'%20.12g'); for i=1:length(xdata) txt(i)=text(xdata(i),ydata(i),tstr(i,:),... 'Parent',ax(1),... 'FontSize',8,... 'Color',cols{i},... 'HorizontalAlignment','right',... 'VerticalAlignment','bottom',... 'Tag','TestNumText',... 'Visible',tnvis,... 'Clipping','off'); end mbcgui.hgclassesutil.setNotPickable(txt)