www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdev_local/ShowTestNum.m

    function txt= ShowTestNum(mdev,ax,NoOutliers,X,Y)
% MODELDEV/SHOWTESTNUM

%  Copyright 2000-2015 The MathWorks, Inc. and Ford Global Technologies, Inc.




if nargin==2 
   NoOutliers=1;
end


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');
   % X = {Xloc,Xglob}  Xloc has our local factors for all sweeps
   Xloc=X{1};
   tn= testnum(Xloc);
   if length(xdata)==length(tn(mdev.FitOK))
      tn= tn(mdev.FitOK);
   end
elseif iscell(X)
   Xloc=X{1};
   tn= testnum(Xloc);
else
    Xloc= X;
    NoOutliers= 0;
    tn=1:size(Xloc,1);
end



if length(xdata)~=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{:});
end   
   

if NoOutliers
   % mle diagnostic plots uses predmode==0
   [Xg,Yrf,Sigma]= mledata(mdev,0,0);
   [Xgc,Yrf,W,dOk] = checkdata(mdev.TwoStage{1},Xg,Yrf,Sigma);
   tn= testnum(X{2});
   tn=tn(dOk);
end

if mv_zoom(ax(1),'on')
    % clip test numbers if axes is zoomed.
    Clip = 'on';
else
    Clip = 'off';
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,...
      'Visible',tnvis,...
      'HorizontalAlignment','left',...
      'VerticalAlignment','bottom',...
      'Tag','TestNumText',...
      'Clipping',Clip);
end
mbcgui.hgclassesutil.setNotPickable(txt)