行列からNaN値を削除するにはどうしたらよいですか?
Show older comments
私の現時点のコードは以下の通りです。コードは最初の19行をスキップして20行目から開始するようにしています。しかし、例えば列が[10;0.04500;0;NaN;NaN]のようなデータからNaN値を削除する必要があります。NaNを削除するための行は実行されますが、実際には削除されません。何がうまくいっていないのかわかりません。この問題をどのように解決すればよいでしょうか?よろしくお願いします。
fid = fopen('filename.txt');
Rows = textscan(fid, '%s', 'delimiter', '\n');
fclose(fid);
Columns= cellfun(@(x) textscan(x,'%f','delimiter','\t','CollectOutput',1) ...
, Rows{1,1}(20:end, :));
fid(isnan(fid(:,1)),:) = [];
Accepted Answer
More Answers (0)
Categories
Find more on 構造体 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!