have two columns that are the same size but one of them has NAN on the first and last row, how would i delete those rows for both columns
2 ビュー (過去 30 日間)
古いコメントを表示
code is this:
[rows, cols] = find(isnan(Fe));
Fe(:,unique(rows)) = [];
WAT(:,unique(rows)) = [];
error message is:
Matrix index is out of range for deletion.
Error in Comparison (line 204)
Fe(:,unique(rows)) = [];
0 件のコメント
採用された回答
Ruger28
2020 年 3 月 2 日
a = 1:10;
b = 1:10;
b(1) = NaN;
b(end) = NaN;
NaN_Vals = find(isnan(b));
a(NaN_Vals) = [];
b(NaN_Vals) = [];
2 件のコメント
Ruger28
2020 年 3 月 4 日
No problem! The issue is usually that you remove a row, and then the index is off. Easiest way is to create a list of values (like NaN_Vals) and remove them after the fact, all at once.
その他の回答 (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!