trouble with using isnan function
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Richard Silberstein
el 5 de Nov. de 2019
Respondida: Richard Silberstein
el 5 de Nov. de 2019
Hi,
I have 51 complex arrays temp1(2X390X51). Now I know that all arrays except temp1(:,:,25) comprises valid numerical values.
And all the values in temp1(:,:,25) are described as NaN by matlab. When I use the following in the Command Window: isnan(temp1(2,1,25)) I get the correct Logical 1 ie true) which is correct.
However, when I put the same line: isnan(temp1(2,1,25)) in a loop, the expression yields Logical 0. (ie false, which it is not)
Can anyone tell me what I'm doing wrong?
Thanks
Richard
2 comentarios
the cyclist
el 5 de Nov. de 2019
It would be much easier to diagnose the problem if you upload code and/or variables (in a *.mat file), using the paper clip icon.
James Tursa
el 5 de Nov. de 2019
Editada: James Tursa
el 5 de Nov. de 2019
Likely the temp1 you are using in a loop differs from the temp1 you are using at the command line. I.e., something in your code is making them different before you do the compare.
Respuestas (1)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!