# To find Middle Value in a array in Labview

#### kooldude

Joined Feb 15, 2018
18
I was writing one program in that i want to find the middle value in an array.so can anyone tell me how to find that value in labview or which function i should use?

#### Picbuster

Joined Dec 2, 2013
979
questions:
a: do you mean a value somewhere in an array starting @ position x and end @ Y?
b: or do you want to calculate the average?

Picbuster

Last edited by a moderator:

#### shteii01

Joined Feb 19, 2010
4,647
Sounds like sorting algorithm homework

#### WBahn

Joined Mar 31, 2012
24,854
I was writing one program in that i want to find the middle value in an array.so can anyone tell me how to find that value in labview or which function i should use?
You need to clarify what you are trying to do -- specifically, what is meant by "middle value".

Do you literally mean the value that is located in the middle position of an array, irrespective of its value or other values in the array? If so, then what qualifies as the "middle" for an even-length array?

Or do you mean the median value in an array? Here again, what is defined as the median value for even-length arrays?

Is this some kind of homework?

How large is the array? Fixed size or variable?

#### kooldude

Joined Feb 15, 2018
18
Build a VI that first accumulates an array of temperature values
.the array size is determined by
a control on the front panel. Initialize an array, using the Initialize
Array function, of the same size where all the values are equal to 10.
Then add the two arrays, calculate the size of the final array, and
extract the middle value from the final array. Display the
Temperature Array, the Initialized Array, the Final Array, and the
Mid Value.
in this for mid value which function i should use or how can i resolve that?

#### WBahn

Joined Mar 31, 2012
24,854
MOD NOTE: Moved to Homework Help.

#### WBahn

Joined Mar 31, 2012
24,854
Build a VI that first accumulates an array of temperature values
.the array size is determined by
a control on the front panel. Initialize an array, using the Initialize
Array function, of the same size where all the values are equal to 10.
Then add the two arrays, calculate the size of the final array, and
extract the middle value from the final array. Display the
Temperature Array, the Initialized Array, the Final Array, and the
Mid Value.
in this for mid value which function i should use or how can i resolve that?
There is no point throwing a bunch of LabView code together unless you understand the problem you are trying to solve.

So do a toy example by hand.

For instance, set the size to 4.

Now collect the temperature values (you don't say what the units are, so I'm going to guess °C).

[21.4, 22.8, 20.9, 23.1]

You take it from there.

Notice that there's some ambiguity in the instructions (as seen from where we sit -- it may be unambiguous based on what you've been told). What does it mean to "add" the two arrays? Most people would assume that when you add two arrays of the same size that it means to add them element by element, but the instructions imply that the size of the final array can be different than the size of the arrays being added, which is at odds with this interpretation. What have you been told?