Azzera filtri
Azzera filtri

What does NaN mean here?

3 visualizzazioni (ultimi 30 giorni)
Mehrdad il 28 Dic 2016
Modificato: Ahmet Cecen il 28 Dic 2016
hi guys
I cannot understand what is happening when we are coding this;
[rowK,colK]= size(K);
In the auxiliary matrix which is being defined what role does NaN plays?

Risposta accettata

Ahmet Cecen
Ahmet Cecen il 28 Dic 2016
Modificato: Ahmet Cecen il 28 Dic 2016
Looks like the code intended to initialize a matrix filled with NaNs and does this by adding NaN to a zero matrix. Any number + NaN is NaN.
You could achieve the same effect with:
aux = NaN(colK);
One common reason you would use NaN instead of 0 is to differentiate when you actually have a value of 0 (say 0 Celsius) versus you have no idea what that value is.

Più risposte (0)


Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by