You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
This code is to convert a categorical vector to a double or numeric vector using the grp2idx function. This is because the labels for LSTM networks and the Neural Network toolbox of MATLAB should be categorical, but you cannot compare two categorical variables or subtract them to find the RMSE, etc.
% An example demonstrating the idea behind this code:
% y = [0,1,3,4,6,0,1]
% ycat = categorical(y)
% [g,gN] = grp2idx(ycat)
% gN(g)
% ydouble = str2num(cell2mat(gN(g)))
Cite As
massie (2026). convertCategorical (https://www.mathworks.com/matlabcentral/fileexchange/67661-convertcategorical), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.0.0.0 (619 Bytes)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.0.0.0 | Description updated Description updated |
