LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

averaging arrays

My program collects a 1-D array of data and sends it to an excel spreadsheet. There are 512 elements in each array. When plotted it forms a gaussian curve. I have been manually averaging my data through excel. I need Lab view to find me the average gaussian curve. In otherwords, I need to be able to loop my program "n" times and have LabView give me the average of the first element in each array, the second, third, and so on. I can attach my program if it would help.
0 Kudos
Message 1 of 11
(3,216 Views)
Is this what you were wanting to do?
 
By the way, your code is very hard to read.  You have wires going in the wrong direction and your block diagram is very large (more than the size of the screen).  I suggest that you move some of your code to subvis and keep the data flow from left to right.
Message 2 of 11
(3,208 Views)

Do you need to set any maximum size to the average, or just however many runs you make--one way is easy to do, the other is trivial.

Mike...

 


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 3 of 11
(3,207 Views)
Thanks for sending the suggestion. I should have stated that I am running version 7.0 so I can't open what you sent .
0 Kudos
Message 4 of 11
(3,197 Views)

No I don't need a maximum, only the number of loops.

Thanks

0 Kudos
Message 5 of 11
(3,197 Views)
Here it is in 7.0.
Message 6 of 11
(3,189 Views)
Here, I tweaked John's code a bit more. Never do in individual values what you can do in arrays. Remember: polymorphism is your friend...
 
Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 7 of 11
(3,184 Views)
oops forgot the code... Smiley Mad

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 8 of 11
(3,184 Views)
Thanks a lot guys. Mike, I'm not quite sure of the cause but it wasn't averaging correctly. The first run worked great. Then the result of each additional run would increase two fold. The original program of Johns's seems to work very well. 
0 Kudos
Message 9 of 11
(3,170 Views)
In order to make Mike's approach work you should initialize the left shift register with an empty array.  It's remembering the value each time you run the vi since the vi is uninitialized. 
0 Kudos
Message 10 of 11
(3,160 Views)