qsubset.m

来自「机器人控制仿真程序一书的所有源代码」· M 代码 · 共 25 行

M
25
字号
function sub = qsubset(x,y)
% QSUBSET Intersection of two vectors. (Utility Function)
%         QSUBSET determines intersection of two vectors and then returns
%         the locations of these intersections.

% Author: Craig Borghesani
% 9/6/93
% Copyright (c) 1995-98 by The MathWorks, Inc.
%       $Revision: 1.4 $

% making sure to put into row format...just for the hell of it.
x=x(:)'; y=y(:)';

if ~length(x),
 x=y;
end

if length(x)~=length(y),
 for k=1:length(x),
  s=find(x(k)==y);
  if ~length(s), error('Mismatch between w and wbd');
  else sub(k)=s(1); end
 end
else sub=1:length(x); end

⌨️ 快捷键说明

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