⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 copybnds.m

📁 机器人控制仿真程序一书的所有源代码
💻 M
字号:
function copybnds(f)
% COPYBNDS Copy bounds. (Utility Function)
%          COPYBNDS copies the bounds from -360deg to 0deg to other ranges if
%          the user specifies new axis limits.

% Author: Craig Borghesani
% Date: 10/10/93
% Revised: 2/17/96 2:53 PM V1.1 update
% Copyright (c) 1995-98 by The MathWorks, Inc.
%       $Revision: 1.4 $

bthan=get(f,'userdata');
infmat=get(bthan(16),'userdata');
bdb=get(bthan(32),'userdata');
phase=get(bthan(33),'userdata');
bhan=get(bthan(12),'userdata');  % handle to all bound buttons
axs=infmat(1,:);
lastphmin=infmat(28,2); lastphmax=infmat(28,3);
phmin=axs(1); phmax=axs(2);
figure(f);

if length(bdb),
 [coora,coorb]=wherebnd(bdb);
 if phmin<lastphmin,
  newbd=ceil(abs(phmin)/360)-1;
  if newbd==0, newbd=1; end
%  taxs=axs;
%tphase=phase;
  for k=newbd:-1:1,
   tphase=phase-360*k;
   taxs(1:2)=axs(1:2)-360*k;
   newbhan=qplotbd(tphase,bdb,coora,coorb,taxs);
   ow=newbhan(6,:); ow=sort(ow); ow(find(diff(ow)==0))=[];
   for h=1:length(ow),
    bnddata=get(bhan(h),'userdata');
    bndvis = get(bnddata(1),'vis');
    newdata=newbhan(1:5,find(ow(h)==newbhan(6,:)));
    bnddata=[bnddata;newdata];
    set(bhan(h),'userdata',bnddata);
    set(bnddata,'vis',bndvis);
   end

% this is the On/Off button
   bnddata=get(bhan(length(ow)+1),'userdata');
   set(bhan(length(ow)+1),'userdata',[bnddata;newbhan(1:5,:)]);

  end
 end
 if phmax>lastphmax,
  newbd=ceil(abs(phmax)/360);
  if newbd==0, newbd=1; end
%  taxs=axs;
%tphase=phase;
  for k=newbd:-1:1,
   tphase=phase+360*k;
   taxs(1:2)=axs(1:2)+360*k;
   newbhan=qplotbd(tphase,bdb,coora,coorb,taxs);
   ow=newbhan(6,:); ow=sort(ow); ow(find(diff(ow)==0))=[];
   for h=1:length(ow),
    bnddata=get(bhan(h),'userdata');
    bndvis = get(bnddata(1),'vis');
    newdata=newbhan(1:5,find(ow(h)==newbhan(6,:)));
    bnddata=[bnddata;newdata];
    set(bhan(h),'userdata',bnddata);
    set(bnddata,'vis',bndvis);
   end

% this is the on/off button
   bnddata=get(bhan(length(ow)+1),'userdata');
   set(bhan(length(ow)+1),'userdata',[bnddata;newbhan(1:5,:)]);
  end
 end
end

if phmin<lastphmin,
 lastphmin=floor(phmin/360)*360;
 infmat(28,2)=lastphmin;
end
if phmax>lastphmax,
 lastphmax=ceil(phmax/360)*360;
 infmat(28,3)=lastphmax;
end
set(bthan(16),'userdata',infmat);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -