Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.0 - Français

Change language to:
English - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Aide de Scilab >> Fonctions Elémentaires > Opérations sur les ensembles > setdiff

setdiff

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

Calling Sequence

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 — extrait les composantes distinctes d'un vecteur ou d'une matrice
  • gsort — tri par l'algorithme "quick sort"
  • union — extrait les composantes distinctes issues de l'union de deux vecteurs
Report an issue
<< unique Opérations sur les ensembles Traitement du signal >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Fri Apr 11 14:14:51 CEST 2014