How do I get MATLAB to automatically create a vector of unique values based on a known vector of values?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Brad
il 17 Ott 2013
Modificato: Azzi Abdelmalek
il 17 Ott 2013
Let's say I have a vector of known values:
A = [10;20;30;100;200;10;20;30;40;50];
I'm looking for a way to get MATLAB to automatically create vector B of unique values, based on A.
So for the 7 unique values in A, B = [1;2;3;4;5;6;7]
Is there a way to make this happen?
0 Commenti
Risposta accettata
Azzi Abdelmalek
il 17 Ott 2013
Modificato: Azzi Abdelmalek
il 17 Ott 2013
A=[10;20;30;100;200;10;20;30;40;50];
B=1:numel(unique(A))
0 Commenti
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Get Started with MATLAB in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!