Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

ArrayOperation.MaxMin Bug?

We are reading some data files that were saved by LabVIEW and contain "NaN" as some of the data fields. When I use ArrayOperation.MaxMin on these using the Measurement Studio in C#, the Max value returned is NaN. I couldn't see any reference to this in the NI MS 7.0 help. Is this a bug or desired operation? Do I need to create my own MinMax function to workaround this?

Thanks,
Derek
0 Kudos
Message 1 of 3
(3,584 Views)
Hi Derek,
MinMax should not report a NaN as a max Value.

I couldnt' reproduce this at first, but then after some quick further testing realized that this does happen in two cases ..(1) If all the elements are NaN (which makes sense) or (2) If the first element of the input array is a NaN (which is a bug).
Is this what you see ?

MinMax works correctly for me if there are multiple(but not all) NaNs in my input array, and as long as the first element is NOT a NaN.

If this is the case, you could simply check for the 1st element being NaN and then use MinMax accordingly
Hope this helps some...
Best Regards,
Nandan
Nandan Dharwadker
Staff Software Engineer
Measurement Studio Hardware Team
0 Kudos
Message 2 of 3
(3,584 Views)
Hi Nandan,

I filtered the data in another method before doing the MinMax to workaround this. Our data will either be all non-NaN data or a starting contiguous block of NaN followed by actual data followed by another contiguous block of NaN data.

Thanks,
Derek
0 Kudos
Message 3 of 3
(3,584 Views)