LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with mode.vi

In the help files for LabVIEW 7.1, it says this about mode.vi:
X must contain at least one sample. If X is empty, the histogram is undefined, the error returns through the Histogram VI, and the Mode VI sets mode to NaN.

If the following input sequence has a constant value, the Mode VI ignores the number of intervals and sets mode to the constant value in the input sequence:

if X = a mode = a

 

When I input the dataset

{10, 10}

with an interval of 1, I get the answer NaN and the VI complains that it requires Top > Base.  Am I misinterpretting the help file or is this an error with the VI?

 

Thanks,

Michelle

0 Kudos
Message 1 of 9
(3,704 Views)

Hi Michelle,

Can you post a simple example of the code that isn't working correctly for you?

Thanks
Chris J

0 Kudos
Message 2 of 9
(3,688 Views)
Chris J,
Here is an example of the included mode VI with the default input array set to {10, 10}.
 
Regards,
Michelle
Download All
0 Kudos
Message 3 of 9
(3,684 Views)
I should have taken the screenshot showing the error condition...  Here's the results of running mode.vi, shown in the screenshot.
0 Kudos
Message 4 of 9
(3,679 Views)
You're not using the mode function, you're running the histogram. The error is expected with an array when all the elements are the same value.
0 Kudos
Message 5 of 9
(3,676 Views)
I realize in that case, I am not using the mode function.  I guess I'm still confused because I thought that the help files were saying that the mode VI would pass through constant values:

If the following input sequence has a constant value, the Mode VI ignores the number of intervals and sets mode to the constant value in the input sequence:

if X = a mode = a

Do you have a different interpretation of the help files?  Thanks for any input...

 

Regards,

Michelle

0 Kudos
Message 6 of 9
(3,652 Views)
This has been fixed in LabVIEW 8.  See the attached screenshort.
Message 7 of 9
(3,625 Views)
I'm glad it has been fixed!  Unfortunately, I'm running LabVIEW 7.1 and don't plan to upgrade right now.  Are there any fixes for 7.1?  I can always write code to check the case when all values are the same...
0 Kudos
Message 8 of 9
(3,619 Views)
In case anyone was wondering, I've attached a screenshot showing the changes I made to mode.vi so that it would work in LabVIEW 7.1 as it is supposed to.
 
ENJOY!
0 Kudos
Message 9 of 9
(3,595 Views)