setdiff

setdiff(A,B) returns the data in A that is not in B in ascending order and without repetition.

Examples

>> A = [9 7 1 4 5 1]
B = [4 5 9]
setdiff(A,B)#

            1
            7
>> A = {'a' 'b' 'c' 'd'}
B = {'b' 'a' 'z' 'd' 'f'}
setdiff(A,B)#

 [c]
>> t1 = table([10; 15; 4], {'a'; 'b'; 'c'})
t2 = table([15; 4; 0], {'b'; 'd'; 'f'})
setdiff(t1, t2)#

          Col1 Col2 
             4    c 
            10    a 

See also

intersect | ismember