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 天)
显示 更早的评论
采纳的回答
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!