Deleting an entire column using an IF statement
1 回表示 (過去 30 日間)
古いコメントを表示
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,
0 件のコメント
採用された回答
madhan ravi
2020 年 6 月 15 日
編集済み: madhan ravi
2020 年 6 月 15 日
data(:,all(isnan(data))) = [] % deletes entire column
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!