Changing Array Elements with logical indexing
2 次查看(过去 30 天)
显示 更早的评论
Hi
If I want to change all NaNs in an array A to zero, the following works:
A(isnan(A))=1000
As far as I see the isnan(A) returns nothing but an array of 1's and 0's.
But if I do the following:
B = [ 1 5 8]; B([0 0 1]) = 1000;
to replace the 8 with a 1000, I get an error - why?
0 个评论
采纳的回答
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!