LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sum values from array, then take percentage.

New to labview this is probably really simple but I am hitting a road block.

 

I am using a DAQ device to read in 3 values continuously.  I want to take these three values and get the percentage of each one from the total, the output to a graph the %.  I'm not sure how to get the sum of the values from the array.

 

For example:

 

Value 1 = 7

Value 2 =5

Value 3 = 8

 

Sum = 20

 

Value 1 % = 35%

Value 2 % = 25%

Value 3 % = 40%

 

Thanks for any help.

0 Kudos
Message 1 of 5
(3,149 Views)

Lycle wrote: I'm not sure how to get the sum of the values from the array.

Add Array Elements


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(3,146 Views)

This should do the trick. Instead of the 3 random numbers, substitute your inputs. Even better, send the array of inputs directly into the "sum array" input wire.

percentage_chart.png

0 Kudos
Message 3 of 5
(3,134 Views)

Why do you index the array instead of just plugging it into your divide?  You'd get the same result.

0 Kudos
Message 4 of 5
(3,105 Views)

@ijustlovemath wrote:

This should do the trick.


 

 That makes very little sense.


Lycle wrote: 

I am using a DAQ device to read in 3 values continuously.  I want to take these three values and get the percentage of each one from the total, the output to a graph the %.  I'm not sure how to get the sum of the values from the array.


 How should the graph look like? Do you want to chart the three percentages over time forever or do you only want to see the current three percentages?

 

If you want to chart the three over time, you could do something as follows:

 

 

 

0 Kudos
Message 5 of 5
(3,086 Views)