Ask Your Question

"Not-a-Number" NaN with arithmetical operations

asked 2013-07-26 06:12:24 -0500

carlosb gravatar image


I have a doubt. I am doing a division between two vectors (65356x1 size). Both vectors include 0s and It divides each array element. The problem is when it divides by 0s, operation (0/0), its result is not NaN, is 0!. I think It is wrong... Are there some way to get the correct result (with NaNs)?

The code is very simple: Mat G = im_g/tableReshaped; (where img_g and tableReshaped are 65356x1 matrices).

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-10-03 18:04:54 -0500

carlosb gravatar image

updated 2013-11-05 18:03:43 -0500

It is the expected behavior and i couldn't change it. I replaced to the values with NaN manually....

edit flag offensive delete link more

Question Tools


Asked: 2013-07-26 06:12:24 -0500

Seen: 265 times

Last updated: Nov 05 '13