How to compare values in one vector?

1 vue (au cours des 30 derniers jours)
huanghui shi
huanghui shi le 9 Avr 2020
Réponse apportée : KSSV le 9 Avr 2020
for example B=[1,2,2,5,4,4]
so i only want output 1,5,i dont want 2,4 because they have same value in this vector.
how to do this within fop-loop?
  1 commentaire
BN
BN le 9 Avr 2020
You can use the unique function

Connectez-vous pour commenter.

Réponses (1)

KSSV
KSSV le 9 Avr 2020
a=[1,2,2,5,4,4];
xbins = unique(a);
[counts,centres] = hist(a,xbins);
iwant = a(counts==1)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by