Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.1 - Português

Change language to:
English - Français - 日本語 - Русский

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

Ajuda do Scilab >> Funções Elementares > Set operations > unique

unique

remover todos os componentes duplicados de um vetor ou uma matriz

Seqüência de Chamamento

[N ,k] = unique(M)
[N ,k] = unique(M, orient)

Parâmetros

M

vetor ou matriz de números ou strings

orient

flag com valores possíveis : 1 ou "r", 2 ou "c"

N

  • If orient is not used: Vector of extracted M components sorted in ascending order.
  • If orient is used: Matrix of extracted M rows or columns, sorted in lexicographic ascending order.

k

Vector of indices of first encountered occurences, such that N(i) = M(k(i)) or N(i,:) = M(k(i),:) or N(:,i) = M(:,k(i)).

Descrição

unique(M) retorna um vetor que retém as entradas únicas de M em ordem ascendente.

unique(M,"r") ou unique(M,1)retorna as linhas únicas de M em ordem lexicográfica ascendente.

unique(M,"c") ou unique(M,2)retorna as linhas únicas de M em ordem lexicográfica ascendente.

Extracted components, rows or columns can be resorted in their initial order by sorting k:
[N, k] = unique(M);      k = gsort(k,"g",i); N = N(k)
[N, k] = unique(M, "c"); k = gsort(k,"g",i); N = N(:, k)
[N, k] = unique(M, "r"); k = gsort(k,"g",i); N = N(k, :)

Exemplos

M = round(2*rand(20,1));

unique(M)
[N,k] = unique(M)

unique(string(M))
[N,k] = unique(string(M))

A = [0,0,1,1;
     0,1,1,1;
     2,0,1,1;
     0,2,2,2;
     2,0,1,1;
     0,0,1,1];
T = 'x'+string(A);

//linhas únicas
[m,k] = unique(A,'r')
unique(T,'r')

//colunas únicas
[m,k] = unique(T,'c')
unique(A,'c')

Ver Também

  • members — count (and locate) in an array each element or row or column of another array
  • gsort — ordenação decrescente
  • vectorfind — acha, em uma matriz, linhas ou colunas que coincidem com um vetor
  • grep — acha correspondências de um string em um vetor de strings
  • union — extrai componentes da união de um vetor
  • intersect — returns the vector of common values of two vectors
Report an issue
<< union Set operations Signal processing >>

Copyright (c) 2022-2023 (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:
Mon Feb 12 19:58:35 CET 2018