To convert categorical to double
129 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Convert categorical '12' to double/numeric 12
%For example
Data=[2 36; 56 23]; %If i execute this data it will be in double format
To_categorical=categorical(Data); % then i am converting to categorical format
To_double= ???? % If i need to convert "TO_categorical" back to double
2 comentarios
Respuestas (3)
cater re
el 20 de Nov. de 2019
Editada: cater re
el 20 de Nov. de 2019
If you have source. you can do it with below.
data = [2 7 3 50 5 6 60]
catdata = categorical(data)
catidx = double(catdata)
sdata = sort(data)
converted = sdata(catidx)
If there is no source, how to convert it?
catdata = categorical([2 7 3 50 5 6 60])
converted = str2num(char(catdata))'
If useful, thumb up!
0 comentarios
KSSV
el 23 de Mzo. de 2018
Read about double
Data=[2 36; 56 23]; %If i execute this data it will be in double format
To_categorical=categorical(Data)
idx = double(To_categorical) ;
Data(idx)
Walter Roberson
el 20 de Nov. de 2019
catdata = categorical([2 7 3 50 5 6 60]);
catnames = categories(catdata);
converted = str2double(catnames(catdata)).';
0 comentarios
Ver también
Categorías
Más información sobre Data Type Conversion 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!