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

📄 ismemb.m

📁 JLAB is a set of Matlab functions I have written or co-written over the past fifteen years for the p
💻 M
字号:
function[bool]=ismemb(a,b,tol)%   ISMEMB Tests whether the elements of an array are members of a set.%%   ISMEMB(A,B) for scalar A is true if A is a member of the array B,%   and false otherwise.  For array A, ISMEMB tests whether each%   element of A is a member of B, and returns an array of size%   SIZE(A).%%   Equality is judged to within a small numerical tolerance specified%   by ISMEMB(A,B,TOL), with a default of TOL=1e-10;%%   See also SUBSET, LOOKUP%   _________________________________________________________________%   This is part of JLAB --- type 'help jlab' for more information %   (C) 2003, 2004 J.M. Lilly --- type 'help jlab_license' for details  if nargin==2    tol=1e-10;  endif any(~isfinite(a)) || any(~isfinite(b))  error('Elements of A and B should be finite (non-NAN, non-INF).')endbool=ones(size(a));a=a(:);b=b(:);%bool1=(osum(a,-b)==0);bool1=(abs(osum(a,-b))<=tol);index=find(sum(bool1,2)==0);   %this is equivalent to "any"bool(index)=0;%This convienently gets around explicitly needing to know the %dimensionality of A, and also reshaping.      

⌨️ 快捷键说明

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