LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

arithmetic average with LabVIEW 6.1

Hallo,

I have an array containing six rows and 3 columns. My task is to calculate the arithmetic average of the elements in the columns and add it as a seventh row to the array. How can I do that? I added a txt-file with the array.
0 Kudos
Message 1 of 9
(3,589 Views)
I have attached two examples. The first one averages the six values in each column and outputs it in a seventh row of the array. I didn't know if you would want to do more than just an average of the seventh row or not, so I am also adding an example that adds the average every second.

I hope this helps.

Lauren
Download All
0 Kudos
Message 2 of 9
(3,589 Views)
Hi Lauren,

thanks for the answer. Your idea works, but I need a more generous version:

I have to extract the rows from a 2D-array, compute the arithmetic average of each row and add this value as a seventh column. Finaly I merge the rows together again to one 2D-array and save it to a txt-file.

By the way, it won't have three rows, but more than 20. The VI should count the number of needed rows by itself.

Perhaps someone can help me now.

Arno
0 Kudos
Message 3 of 9
(3,589 Views)
I added my VI and the resulting output. What is wrong?

Arno
Download All
0 Kudos
Message 4 of 9
(3,589 Views)
Here's a simple way to do it, no counting of columns or rows needed.

(Since in the US the decimal separator is ".", I added a step to change this to be able to read the fractional parts. You probably don't need this step if your system is set to "," as decimal separator.)
0 Kudos
Message 5 of 9
(3,589 Views)
Quick note: If you use "Read from spreadsheed file", you only need the tiny FOR loop, that's it!
0 Kudos
Message 6 of 9
(3,589 Views)
Your problem is shift registers.

Also, why did you transpose an array twice? I was confused by that. Was that on purpose or accident.

See if this works right.
0 Kudos
Message 7 of 9
(3,589 Views)
Sorry, I confused "row" with "column" in your description, just transpose as in the attached VI.
(I assume your system is set for "," as decimal separator).

You don't need a huge pile of code for this!
0 Kudos
Message 8 of 9
(3,589 Views)
The easiest ways are always the best !!

Thanks for helping me.
0 Kudos
Message 9 of 9
(3,589 Views)