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?

采纳的回答

Jos (10584)
Jos (10584) 2018-3-1
not (~), all, and isnan are your friends. If A is your array,
while ~all(isnan(A(:)))
...
end
  2 个评论
evangeline
evangeline 2018-3-2
How can I check if I have a cell array?
Stephen23
Stephen23 2018-3-2
编辑:Stephen23 2018-3-2
@Evangeline: iscell, whos, or look at the description in the workspace. How is this related to your question?

请先登录,再进行评论。

更多回答(1 个)

evangeline
evangeline 2018-3-2
I mean how can I check if all array elements are nan, if my array is an cell array.

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by