# Measures of Mean (Mode » Unimode) (G Dataflow)

Finds the most common values of a sequence.

Use this node if the input sequence is unimodal or you expect a one-scalar mode result.  ## reset

A Boolean that specifies whether to reset the internal state of the node.

 True Resets the internal state of the node. False Does not reset the internal state of the node.

This input is available only if you wire a double-precision, floating-point number to x.

Default: False ## x

Input sequence.

x must contain at least one sample. If x is empty, this node sets mode to NaN.

If the input sequence has a constant value, this node ignores the number of intervals and sets mode to the constant value in the input sequence:

if x = a, mode = a.

This input accepts a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers. ## sample length

Length of each set of data.

The node performs computation for each set of data. sample length must be greater than zero.

This input is available only if you wire a double-precision floating-point number to x.

Default: 100 ## number of bins

Number of histograms to use when computing estimated modes.

Default: 100 ## error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error  If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error ## mode

Mode or estimated mode of the input sequence. ## error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error  If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

## Finding Estimated Modes of the Input Sequence

To find estimated modes, set number of bins to a positive number of histogram bins so that the node uses a histogram algorithm to return the best estimated mode of the input sequence.

For intervals less than or equal to 0, the node returns only the exact mode(s) of the input sequence. For intervals greater than 0, the node uses a histogram to divide the input sequence into bins, or intervals, and returns the center value (unimode) or values (multimode) of the bin that contains the most values from the input sequence.

These estimated modes are generally more useful than the exact modes in real-world applications, where the data sequence contains even a small amount of noise.

The following table demonstrates how this node finds the mode of a sequence.

x number of bins mode Comments
{0, 1, 3, 3, 4, 4, 4, 5, 5, 7} 1 3.5

3.5 is the center value of the single histogram number of bins specifies.

{0, 1, 3, 3, 4, 4, 4, 5, 5, 7} 0 4

The node returns the exact mode 4.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application