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?

 Akzeptierte Antwort

Jos (10584)
Jos (10584) am 1 Mär. 2018

4 Stimmen

not (~), all, and isnan are your friends. If A is your array,
while ~all(isnan(A(:)))
...
end

2 Kommentare

evangeline
evangeline am 2 Mär. 2018
How can I check if I have a cell array?
Stephen23
Stephen23 am 2 Mär. 2018
Bearbeitet: Stephen23 am 2 Mär. 2018
@Evangeline: iscell, whos, or look at the description in the workspace. How is this related to your question?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

evangeline
evangeline am 2 Mär. 2018

0 Stimmen

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

Kategorien

Community Treasure Hunt

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

Start Hunting!

Translated by