Deleting an entire column using an IF statement

조회 수: 1 (최근 30일)
Jake Bowd
Jake Bowd 2020년 6월 15일
편집: madhan ravi 2020년 6월 15일
Hi,
I have a 91 x 265 double for which sometimes the first column contains NaN values. If the first column contains NaN values I would like to delete it. If the first column does not inlcude NaN I wish to keep that as the first column.
data = RESULTS.IK_Original(1).data;
NaN 0.308000000000000 0.0290000000000000 -0.790000000000000 0.993000000000000
NaN 0.317000000000000 0.0280000000000000 -0.779000000000000 0.991000000000000
NaN 0.325000000000000 0.0270000000000000 -0.768000000000000 0.990000000000000
NaN 0.333000000000000 0.0260000000000000 -0.758000000000000 0.989000000000000
NaN 0.342000000000000 0.0250000000000000 -0.747000000000000 0.989000000000000
NaN 0.350000000000000 0.0240000000000000 -0.736000000000000 0.988000000000000
NaN 0.358000000000000 0.0230000000000000 -0.725000000000000 0.988000000000000
NaN 0.367000000000000 0.0220000000000000 -0.714000000000000 0.987000000000000
NaN 0.375000000000000 0.0200000000000000 -0.703000000000000 0.988000000000000
Note: this is just the first 9 rows and 5 columns of my data.
Many thanks,

채택된 답변

madhan ravi
madhan ravi 2020년 6월 15일
편집: madhan ravi 2020년 6월 15일
data(:,all(isnan(data))) = [] % deletes entire column

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by