How do I replace (or remove) <undefined> with NaN in a categorical array ?
40 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Douglas Leaffer
il 8 Dic 2022
Commentato: Douglas Leaffer
il 9 Dic 2022
How do I replace (or remove) <undefined> with NaN in a categorical array ? .dat file excerpt is attached. Thanks for any help !
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1224617/image.jpeg)
0 Commenti
Risposta accettata
Cris LaPierre
il 8 Dic 2022
<undefined> is the value used for a missing categorical entry. NaN is for missing numerical values.
You can replace missing values using fillmissing
3 Commenti
Cris LaPierre
il 8 Dic 2022
Modificato: Cris LaPierre
il 8 Dic 2022
Your table variable source is of type categorical, so you must use a valid categorical data type, which is categorial, char array, or string.
- categorical(0)
- "0"
- "None"
Here is an example that uses "None"
load Table4excerpt.mat
T41.source = fillmissing(T41.source,'constant',"None")
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Categorical Arrays in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!