Not a Number




I wrote a module putting values into handles.measurements to be analysed by the CellProfiler Analyst (with SQL database).

I was wondering how the SQL database and the Analyst deal with MatLab NaN (Not a Number)?
Is it possible to use NaN?

kind regards,


Hi Christian,

The LOAD DATA MySQL command will typically convert NaNs to zeros. At least, that’s what ours does, though I imagine you could configure your server to handle these non-standard data otherwise. However, it’s my understanding that if they are FLOATS (as we typically set up measurements to be), then NaN, +/-Inf are considered invalid, not allowed, and converted to zeros typically.

Since we take the position that any conversion of data values is dangerous, or misleading at least (whether or not WARNINGs are displayed), we have been systematically removing cases which might generate measurements with NaNs or +/-Inf. You of course can handle your data how you like, but we often initialize values to zero or some other floating point value that will hopefully indicate them as such. We can certainly see the value of having NaNs in certain cases, but the limits of MySQL prevent us.

I do not know how CPAnalyst will handle NaNs if you manage to configure your system to allow them, since we have not been allowed to use them.