can't fill missings on table

조회 수: 1 (최근 30일)
kira
kira 2019년 2월 19일
댓글: kira 2019년 2월 20일
Hi,
when running
opts = detectImportOptions(filename);
opts.SelectedVariableNames={'TimeStamp','RAW_AF7','RAW_AF8','RAW_TP9','RAW_TP10','AUX_RIGHT'};
T = readtable(filename,opts,'ReadVariableNames',true);
summary(T)
Variables:
TimeStamp: 64x1 cell array of character vectors
RAW_AF7: 64x1 double
Values:
Min 4.0293
Median 602.99
Max 1650
RAW_AF8: 64x1 double
Values:
Min 0.80586
Median 405.75
Max 1650
NumMissing 2
RAW_TP9: 64x1 double
Values:
Min 7.2527
Median 879.6
Max 1650
NumMissing 3
RAW_TP10: 64x1 double
Values:
Min 24.982
Median 865.7
Max 1650
NumMissing 4
AUX_RIGHT: 64x1 double
Values:
Min 0
Median 825.6
Max 1650
NumMissing 3
t = fillmissing(T,'pchip');
I'm getting:
Error using fillmissing/checkArrayType (line 507)
Table contains variables of types for which the 'pchip'
fill method is not supported.
Error in fillmissing/fillTableVar (line 166)
[intConstVj,extMethodVj] =
checkArrayType(Avj,intMethod,intConstVj,extMethodVj,x,true);
Error in fillmissing/fillTable (line 144)
B.(vj) =
fillTableVar(indVj,A.(vj),intMethod,intConst,extMethod,x,useJthFillConstant,useJthExtrapConstant);
Error in fillmissing (line 127)
B =
fillTable(A,intM,intConstOrWinSize,extM,x,dataVars);
what i'm doing wrong?
Here is an example file with 64 rows: csv file
I've tried converting the table to cell, and then every entry to numeric or string, and the back to table, but the error persist.

채택된 답변

Peter Perkins
Peter Perkins 2019년 2월 20일
Apparently at least one of the table variables that you are applying fillmissing to isn't numeric. You will have to figure out which one.
That link doesn't seem very helpful. You should not need to be converting things back and forth. Provide a short eaxmple file, and a short example of what readtable is giving you back.
  댓글 수: 2
kira
kira 2019년 2월 20일
편집: kira 2019년 2월 20일
I will update the answer with new info. All rows with missing values are double. I found the problem, I had to remove the TimeStamp column. How do I put it back?
kira
kira 2019년 2월 20일
nevermind, i figure out! :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by