Borrar filtros
Borrar filtros

How to replace name with number

1 visualización (últimos 30 días)
Light.16
Light.16 el 6 de Oct. de 2016
Comentada: Guillaume el 6 de Oct. de 2016
Hello guys !!
I've a question for you. I got a cell array like that x = {'white' 'red' 'blue' 'yellow'}. My intention is to replace my cell array with a number vector, so that white become 1, red become 2.. and so on. How can i do that?
ty

Respuestas (1)

Thorsten
Thorsten el 6 de Oct. de 2016
[~, ~, xnum] = unique(x, 'stable')
  3 comentarios
Light.16
Light.16 el 6 de Oct. de 2016
which tipe of function is that? IT WORKS!!! :D but how did you do that =???
Guillaume
Guillaume el 6 de Oct. de 2016
In matlab type
doc unique
to read its documentation

Iniciar sesión para comentar.

Categorías

Más información sobre Logical 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!

Translated by