08-02-2016 06:32 AM
Could someone please help me, how could I calculate mean of 1D array? For example, if the 1D-array is [2, 3], I would get mean = 2,5. Thank you very much!
Solved! Go to Solution.
08-02-2016 06:41 AM
Use the mean function. You can use the search or quick drop to look for it in case you don't know where to find it.
Norbert
08-02-2016 06:44 AM
Thank you for your answer! For some reason, the mean function doesn't work properly. Could you please check in the picture, where the problem could be?
08-02-2016 06:51 AM
remove the FOR loop on trhe right. It does not belong there.
08-02-2016 06:55 AM
Thank you for your answer! If I remove the FOR loop, for some reason it gives me NaN output. Input is 1D array and it looks as it should ([1, 2, 3, 2, 1, etc.]).
08-02-2016 07:10 AM
Please post your VI. The image is not sufficient to understand what you are looking for.
NaN is "not a number" which means that you have invalid elements.
Norbert
08-02-2016 07:24 AM
So assuming you are beginner in LabVIEW,
-Create New VI
-Place array constant/ Control and keep numeric constant inside it.
-Now enter 2 and 3 in array
-And then use mean vi: http://zone.ni.com/reference/en-XX/help/371361M-01/gmath/mean/#parent
-Now if your mean output is not 2.5 then mean function is not working correctly ok?
-If the array is empty also you would get NaN.
08-02-2016 07:59 AM
Thank you very much for your help! I found the problem (as you said, it was in the input) and now the mean function works properly! 🙂