How to replace name with number

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

답변 (1개)

Thorsten
Thorsten 2016년 10월 6일

0 개 추천

[~, ~, xnum] = unique(x, 'stable')

댓글 수: 3

Light.16
Light.16 2016년 10월 6일
sorry sir..
but i did't understand :(
Light.16
Light.16 2016년 10월 6일
which tipe of function is that? IT WORKS!!! :D but how did you do that =???
In matlab type
doc unique
to read its documentation

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Entering Commands에 대해 자세히 알아보기

질문:

2016년 10월 6일

댓글:

2016년 10월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by