undefined function 'isnan' for input arguments of type 'table'

조회 수: 104 (최근 30일)
Niraj Acharya
Niraj Acharya 2019년 9월 3일
댓글: Niraj Acharya 2019년 9월 3일
Hi guys,
I have data from a table which looks as below.
y=data(:,20);
X=data(:,[17:19,21:29]);
I am trying to remove some NaN values in data using isnan.
nans = isnan(y) | (sum(isnan(X), 2) > 0);
But, I keep getting error.
undefined function 'isnan' for input arguments of type 'table'
Could somebody please help me?

채택된 답변

Adam
Adam 2019년 9월 3일
편집: Adam 2019년 9월 3일
Assuming data is a table, try using curley braces { } instead of parentheses ( ), i.e.
y=data{:,20};
X=data{:,[17:19,21:29]};
gives details of different ways to access data from a table. similar to a cell array it is the curly braces that actually extract the data into a double, Parentheses extract the data into another table.

추가 답변 (1개)

dpb
dpb 2019년 9월 3일
Presuming the variables in data are named y and X, then
nans = isnan(data.y) | (sum(isnan(data.X), 2) > 0);
You have to select the data itself, not the whole table or subsets thereof.

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by