sca.m

来自「地震解释处理matlab工具箱」· M 代码 · 共 34 行

M
34
字号
function sca
% SCA: set current axis utility
%
% sca
%
% SCA is usefull with figures with multiple axes in setting the current axes as
% MATLAB seems to occaisionally screw this up

% search the figure for axes children
kids=get(gcf,'children');
axes=zeros(1,20); %allow for 20 in a figure
nax=0;
for k=1:length(kids)
   if(strcmp(get(kids(k),'type'),'axes'))
      nax=nax+1;
      axes(nax)=kids(k);
   end
end
p1=get(gca,'currentpoint');
% trap for matlab bug which does not set the current axes properly
if(nax>1)
   for k=1:nax
      ylim=get(axes(k),'ylim');
      xlim=get(axes(k),'xlim');
      p1=get(axes(k),'currentpoint');
      if( between(ylim(1),ylim(2),p1(1,2),2) & between(xlim(1),xlim(2),p1(1,1),2) )
	 set(gcf,'currentaxes',axes(k));
	 break;
      end
   end
end
return;

⌨️ 快捷键说明

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