如何用matlab来,比如当Race=black时,race=1,当Race为其他时,为2。

新手大学初学matlab,还什么都不会,作业很难搞,感谢您的耐心

if, else 不行吗?
if Race == “black”
race = 1
else race =2
end