LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Editing graph data and calculating mean with NaN

Solved!
Go to solution

Hi all,

I have two questions. The first is about calculating the Mean.

I have an array with normal values and NaN values in between. I need to calculate the mean from every couple of measurements (user input). But, my program also takes the NaN values with it, so the more points I want to calculate the mean of, the more data disappears. Now, what I want is this: I want the mean value of all the numeric data, without the NaN's, but I still need the NaN's to be in the array. I've removed the NaN's and then I was able to calculate the mean, but after that, the NaN's have to go back in the array on the place where they first were. I wrote the program as seen in the file, but it doesn't place the NaN's back where they were.

This is a rather long question, I will start a new message for my other question.

 

Thanks a lot in advance.

Download All
0 Kudos
Message 1 of 7
(3,905 Views)

Hi lvl,

 

just filter those NaNs:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(3,891 Views)

Hi,

 

Thanks for the reply! Didn't know about the existence of the 'Not a number/path/refnum?' boolean. This already helped me a lot. Now I'm not quiet there yet. I want the sample length to be a control. The data will end up in a graph, and since the whole bunch is in a while loop, the user should be able to live edit the graph. This works for the sample lengths 1 (made a case structure for that) and two, but after two the graph doesn't change any more. I've attached my program. I hope you can help me further with this.

 

Thanks in advance,

LvL

0 Kudos
Message 3 of 7
(3,848 Views)

Hi lvl,

 

I've attached my program. I hope you can help me further with this.

NO, you didn't attach a "program" - all you attached is an image!

 

If you would attach a real program (aka VI) with some default data embedded I surely will help!

 

Hint: Those PtByPt function also has an "init" input. And I guess you need to use that for each new calculation…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(3,846 Views)

Here it is

I also attached the file I use to read the data from.

Download All
0 Kudos
Message 5 of 7
(3,840 Views)
Solution
Accepted by topic author LvL1995

Hi lvl,

 

try this…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(3,836 Views)

Thank you so much!! Have a great day 😄

0 Kudos
Message 7 of 7
(3,831 Views)