Generate numeric code based on string value
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
phlie
el 16 de Ag. de 2016
Respondida: Thorsten
el 16 de Ag. de 2016
In my cell array, I have one column which contains string values such as a_abc_ABC. How can I generate a new column/ variable which assigns a number to each a_abc_ABC combination? E.g., a_abc_ABC could be 1, a_def_ABC could be 2 etc.
0 comentarios
Respuesta aceptada
Thorsten
el 16 de Ag. de 2016
c = {'a_abc_ABC', 'a_def_ABC', 'b_def_ABC', 'a_abc_ABC', 'a_def_ABC'};
[~, ~, c_num] = unique(c);
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Types en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!