www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mvgraph3d/factor_change.m

    function factor_change(gr,obj)
%FACTOR_CHANGE   Callback function
%  Callback function for the graph3d object

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


% check exclusive setting
ud = gr.DataPointer.info;
if ud.factorselection
   % need to make sure the other selections aren't the same
   dir=str2double(get(obj,'Tag'));
   vals=get([gr.xfactor;gr.yfactor;gr.zfactor],{'Value'});
   vals=cat(1,vals{:});
   val=vals(dir);
   reps=find(vals==val);
   if length(reps)>1
      flds={'xfactor','yfactor','zfactor'};
      chng=setxor(reps,dir);
      hndl=gr.(flds{chng(1)});
      % find a new value to set it to
      used=vals;
      avail=1:4;
      new=setxor(used,avail);
      new=new(1);
      str=get(gr.xfactor,'String');
      if new<=length(str)
         set(hndl,'Value',new)
      end
   end
end

pr_graphlim(gr);
pr_plot(gr);

% fire user callback
if ~isempty(ud.callback)
    xregcallback(ud.callback, gr, []);
end