Ismember function in MATLAB

source

nameFolds(ismember(nameFolds,{
    
    '.','..'})) = [];  % 删除 nameFolds 里面的... 元素

Function prototype: ismember(a,b)

Meaning: See if the number in matrix a is a member of matrix b, if yes, the result returns 1, not 0

Instance

>> a=[ 1 3 5 7 9 ];
>> b=[1 2 3 4 5 6 7];
>> c= ismember(a,b)

c =

  1×5 logical 数组

   1   1   1   1   0

>> d = ismember(b,a)

d =

  1×7 logical 数组

   1   0   1   0   1   0   1

Guess you like

Origin blog.csdn.net/qq_43657442/article/details/109169561