How do I replace (or remove) <undefined> with NaN in a categorical array ?
32 次查看(过去 30 天)
显示 更早的评论
How do I replace (or remove) <undefined> with NaN in a categorical array ? .dat file excerpt is attached. Thanks for any help !
0 个评论
采纳的回答
Cris LaPierre
2022-12-8
<undefined> is the value used for a missing categorical entry. NaN is for missing numerical values.
You can replace missing values using fillmissing
3 个评论
Cris LaPierre
2022-12-8
编辑:Cris LaPierre
2022-12-8
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")
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Categorical Arrays 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!