While all elements are not equal to NaN

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 日

4 投票

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 日

0 投票

I mean how can I check if all array elements are nan, if my array is an cell array.

カテゴリ

ヘルプ センター および File ExchangeCell Arrays についてさらに検索

タグ

質問済み:

2018 年 3 月 1 日

回答済み:

2018 年 3 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by