2

Is there any Matlab function to directly convert nominal data to numeric one ?

N.b that currently, and after several searches, I use NumericGroup=str2num(char(NominalGroup))

Thanks,

JayPeerachai
  • 3,499
  • 3
  • 14
  • 29
Sofiane
  • 67
  • 7

2 Answers2

2

double(NominalGroup) will convert a nominal/categorical array to a double array.

Jonas
  • 74,690
  • 10
  • 137
  • 177
1

Using the double function is dangerous because it returns the category index of the NominalValue.

Example:

color = categorical({'8','9','0'})
x = color(1)  % x = 8
z = double(x) % z = 2

I have been loking for a function that gives me z = 8.

Djan
  • 11
  • 3