欠損データの行の削除方法

エクセルよりデータを読み込みました。 まだ補間は行っていないため、データの欠損があります。 1列目に存在するNaNを検出し、その該当する行のみを削除するにはどのようなコードを利用すればよいでしょうか。 初心者なのでわかりません。教えてください。

 Réponse acceptée

lattice
lattice le 11 Juil 2018

2 votes

isnan で 1 列目の NaN のある行を選んで,その行の全列を空にします.
元のデータを X とすると,
id = isnan(X(:,1));
X(id, :) = [];

Plus de réponses (1)

yuki suda
yuki suda le 11 Juil 2018

0 votes

ありがとうございます。 できました!!

1 commentaire

Jiro Doke
Jiro Doke le 11 Juil 2018
是非、latticeさんの回答を「採用」してあげてください。

Connectez-vous pour commenter.

Catégories

Community Treasure Hunt

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

Start Hunting!