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

📄 isinrect.m

📁 物流分析工具包。Facility location: Continuous minisum facility location, alternate location-allocation (ALA)
💻 M
字号:
function isin = isinrect(XY,xy1xy2)
%ISINRECT Are XY points in rectangle.
%    isin = isinrect(XY,xy1xy2)
%         = isinrect(XY)       % Graphical input of rectangle using GRECT
%  xy1xy2 = rectangle
%         = [min(X) min(Y); max(X) max(Y)]
%
% Note: isin = XY(:,1) >= min(X) & XY(:,1) <= max(X) & ...
%              XY(:,2) >= min(Y) & XY(:,2) <= max(Y)

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

% Input Error Checking ****************************************************
if nargin < 2 || isempty(xy1xy2)
   xy1xy2 = grect;
elseif ~all(size(xy1xy2) == [2 2])
   error('"xy1xy2" must be a 2 x 2 matrix.')
elseif xy1xy2(1,1) > xy1xy2(2,1) || xy1xy2(1,2) > xy1xy2(2,2)
   error('min(X) must be <= max(X) and min(Y) must be <= max(Y).')
end
% End (Input Error Checking) **********************************************

if isempty(xy1xy2)
   isin = [];         % Pass through from GRECT
elseif length(xy1xy2(:)) == 1
   isin = xy1xy2;     % Pass through from GRECT
else
   isin = XY(:,1) >= xy1xy2(1,1) & XY(:,1) <= xy1xy2(2,1) & ...
      XY(:,2) >= xy1xy2(1,2) & XY(:,2) <= xy1xy2(2,2);
end

⌨️ 快捷键说明

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