While all elements are not equal to NaN
66 次查看(过去 30 天)
显示 更早的评论
I have an array and I turn one element to NaN in each iteration until all elements are NaN, like:
While (all elements in array are not NaN)
do aomething
End
How can I do this?
0 个评论
采纳的回答
Jos (10584)
2018-3-1
not (~), all, and isnan are your friends. If A is your array,
while ~all(isnan(A(:)))
...
end
2 个评论
更多回答(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!