Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: Français - Português - Русский - 日本語
Scilab Help >> Elementary Functions > Set operations > setdiff

setdiff

returns components of a vector which do not belong to another one

Syntax

v=setdiff(a,b)
[v,ka]=setdiff(a,b)

Arguments

a

vector of real numbers or strings

b

vector of real numbers or strings

v

vector of real numbers or strings with same orientation than a

ka

row vector of integers, ka(i) is the location of v(i) in a

Description

setdiff(a,b) returns a sorted vector which retains the a entries which are not in b

[v,ka]=setdiff(a,b) returns a sorted vector which retains the a entries which are not in b and the location of these entries in a.

Examples

a = [223;111;2;4;2;2];
b = [2;3;21;223;123;22];
setdiff(a,b)
[v,k]=setdiff(string(a),string(b))

See Also

  • unique — remove all duplicate components of a vector or a matrix
  • gsort — sorting by quick sort algorithm
  • union — extract union components of a vector
Scilab Enterprises
Copyright (c) 2011-2015 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Jun 15 08:27:34 CEST 2016