How to attribute a letter to unique combinaisons
Mostra commenti meno recenti
Hi,
I have a very simple question that is a bit tricky to explain: I have a table like this
var_a = {'T1','T1','T1','T1','T1','T1','T2','T2','T2','T2','T2','T2','T2','T2'}';
var_b = [2,2,2,2,3,3,8,8,8,9,9,10,10,11]';
t = table(var_a, var_b)
and for every unique var_a id, I want every unique combinaison between var_a and var_b to be attributed a different letter beginning with 'A'. In other words the desired output would looks like this:
var_a = {'T1','T1','T1','T1','T1','T1','T2','T2','T2','T2','T2','T2','T2','T2'}';
var_b = [2,2,2,2,3,3,8,8,8,9,9,10,10,11]';
var_c = {'A', 'A', 'A', 'A', 'B', 'B', 'A', 'A', 'A', 'B', 'B', 'C', 'C', 'D'}';
desired_out_put = table(var_a, var_b, var_c)
Thank you,
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Software Development in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!