01-11-2016 07:32 PM
MS v15.0.0.49153 generates unknown exception error -20104 when NaN is found in array. Statistics.Mean handles this condition by returning NaN and not generating an exception. Following code demonstrates:
Random rnd = new Random();
double[] tmp = new double[10];
for (int j=0; j < tmp.Length; j++) tmp[j] = rnd.Next ();
Console.WriteLine (Statistics.Mean (tmp));
Console.WriteLine (Statistics.Median (tmp));
tmp[5] = Double.NaN;
Console.WriteLine (Statistics.Mean (tmp));
Console.WriteLine (Statistics.Median (tmp));
Last statement causes unknown exception error. Would prefer to either return NaN or generate a known error.
01-12-2016 09:38 AM
When I enter in error code -20104 into LabVIEW's "Explain Error" tool I recieve the following message:
Possible reason(s):
Analysis: Input parameters have at least one NaN element.
I believe this is the type of behavior you were looking for, though it might not necessarily be shown in MS 2015.