LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Repeatively extract certain number

Can anyone tell me how to do this if i want to extract row of data and converted into average for 300 data. i.e my array consist elements {1,1,2,1,4,2,3,1,5,6,8}. I need to extract element 1,1,2,4 and 3,1,5,6,8. Both average value 2 and 11.5 respectively. Thank you.
0 Kudos
Message 1 of 7
(2,676 Views)
If all you need to do is to calculate the average of a segment of the array just wire the array to the array subset function and specify the start and length of the subset you want. Wire the output to the average function (or a sum-function and then divide by the length).

If the arrays are very large using the subset function might require a lot of memory, in that case use the index array element in a loop with a shift register and add the elements you want in the loop (keep the previous result in the shift reg), then divide the output by the number of elements. The latter procedure works also nicely if you need the average of elements separated from eachother in the array.
0 Kudos
Message 2 of 7
(2,676 Views)
I have try it but still cannot solve it i wonder if you can have a look at my block diagram cause i am new in labview just started couple of weeks. Or perhaps you can show me some examples. Thank you.
Download All
0 Kudos
Message 3 of 7
(2,676 Views)
Here you go. I've modified your code to work and I've added an averaging of the first 10 values (you haven't said whay parts you want to average so it's just an example).

Note that for this code to work the OS must also use the same decimal character as in the file (I had to replace the .s in the file with commas for it to work on my machine since I use a Norwegian style decimal).
0 Kudos
Message 4 of 7
(2,676 Views)
Thank for you help. I need the average value to plot a graph another graph. This is the first 10 value averge but how about the rest of my data, because i a set of average value. i.e average first 10 values of my data and then second 10 values and so on until finish process my data. (in between each average value i have 6 values but i don't want these values).
0 Kudos
Message 5 of 7
(2,676 Views)
What exactly is it you want to calculate an average from?

You say you want to average the first 10 and then the next 10...which sound OK, then it's just creating an averaged graph, but you also say that in between the averages there are 6 values you don't want. Are you saying that you want the average of the first 10, then the average of values 16-25..then 32-41 etc..?

As soon as I know exactly what data you want to use for the averaging and how you want the result presented I can make it for you.
0 Kudos
Message 6 of 7
(2,676 Views)
Yes you are right. Actually i need to convert the current graph current vs time to charge vs flowrate and obtained the slope of it. But i need to assign each flowrate value to each horizontal value (constant or plateau value) in the charge vs time. Take a look what i mean.
0 Kudos
Message 7 of 7
(2,676 Views)