clip.m
来自「包含大量遗传算法程序」· M 代码 · 共 22 行
M
22 行
function in=clip(x,y,area)
%CLIP Indicate which points lie outside the area.
% CLIP(X,Y,AREA) returns a logical column vector the same
% length as X with 1's for the (x,y) pairs which lie inside AREA.
% X and Y are vectors
% AREA is a four element vector [Xmin,Xmax,Ymin,Ymax]
% See AXIS
% Dr M.P. Ford 4th August 1987
% Copyright (c) 1987 by GEC Engineering Research Centre & Cambridge Control Ltd
% MRN019
[m,n]=size(area);
if (min(m,n)~=1)|((m*n)~=4)
error('The AREA vector has the wrong dimensions')
end
% Now index points outside or on the borders
ix=(x>=area(1))&(x<=area(2));
iy=(y>=area(3))&(y<=area(4));
in=ix(:)&iy(:);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?