I have a table and I am trying to replace all the NaN values with 0. Based on the documentation for 'fillmissing' this should be straightforward but when I execute the commands:
d = [NaT; NaT; NaT; NaT; NaT];x = [2; 4; 3; NaN; NaN];t = table(d,x)fillmissing(t,'constant',0)
It produces the following error:
Error using fillmissing/checkArrayType (line 517)
Invalid fill constant type.
Error in fillmissing/fillTableVar (line 155)
[intConstVj,extMethodVj] = checkArrayType(Avj,intMethod,intConstVj,extMethodVj,x,true);
Error in fillmissing/fillTable (line 133)
B.(vj) = fillTableVar(indVj,A.(vj),intMethod,intConst,extMethod,x,useJthFillConstant,useJthExtrapConstant);
Error in fillmissing (line 116)
B = fillTable(A,intM,intC,extM,x,dataVars);
Why do I get this error and how can I prevent this?
Best Answer