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

📄 findxy.m

📁 物流分析工具包。Facility location: Continuous minisum facility location, alternate location-allocation (ALA)
💻 M
字号:
function idx = findXY(XY,xy1xy2)
%FINDXY Find XY points inside rectangle.
%   idx = findXY(XY,xy1xy2)
%       = findXY(XY)          Graphical selection of rectangle
%xy1xy2 = rectangle
%       = [min(X) min(Y); max(X) max(Y)]
%
% Graphical selection of rectangle:
%    (1) Press <SPACEBAR> or select point outside axes to toggle zoom
%    (2) Press <ESC> key to erase last points selected
%    (3) Press <RETURN> to stop selecting points
%    (4) Use 'Erase Iter Plot' on Matlog figure menu to erase green circles
%        around selected points (or 'delete(findobj('Tag','iterplot'))')
%
% Note: Wrapper for idx = FIND(ISINRECT(XY,xy1xy2))

% Copyright (c) 1994-2006 by Michael G. Kay
% Matlog Version 9 13-Jan-2006 (http://www.ie.ncsu.edu/kay/matlog)

% Input Error Checking ****************************************************
% End (Input Error Checking) **********************************************

if nargin > 1 && ~isempty(xy1xy2)
   idx = find(isinrect(XY,xy1xy2));
else
   idx = [];
   done = 0;
   h = [];
   disp('Press <SPACEBAR> to zoom, <ESC> to erase, and <RETURN> to stop')
   while ~done
      isin = isinrect(XY);
      if islogical(isin) && any(isin)
         cidx = find(isin(:));
         h = pplot(XY(cidx,:),'go','Tag','iterplot');
         drawnow
         idx = [idx; cidx];
      elseif ~isempty(isin) && isin == 32   % SPACEBAR to toggle zoom
         zoom
      elseif ~isempty(isin) && isin == 27 && ishandle(h) % ESC key to erase
         idx = setdiff(idx,cidx);
         delete(h)
         drawnow
      elseif ~isempty(isin) && isin == 13   % RETURN key to exit
         idx = sort(idx);
         done = 1;
      end
   end
end

⌨️ 快捷键说明

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