ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with an array

Solved!
Go to solution

Well guys I have an array that gives me positive and negative values.

 

I need to use this array and get 2 new arrays, one is the array of positive values, second is the array with negative values, after that i have to get 2 values from it, one is the sum of all positive elements and i need to know how much positive elements too.

the second value is the sum of all negative elements and how much negative elements too.

 

 

 

Example:

 

Array: 5, -12, 2, -3, 4

 

First Array: 5,2,4

First Value: 5+2+4 = 11

Numbers of elements: 3

 

 

Second Array: -12,-3 

Second Value: -12+(-3) = -15

Numbers of elements: 2

 

 

Something like that!

 

Thanks

0 Kudos
Message 1 of 20
(5,124 Views)

Something like this maybe, assuming zero is positive.

Dan
CLD
Message 2 of 20
(5,114 Views)

Hey Dan thanks for the example, it works for me but I need get 2 arrays too

one with all positive values, and the other with all negative values!?

it can be made?

 

Thanks

0 Kudos
Message 3 of 20
(5,106 Views)

Hi,

The attached code will work for your requirement..let me know if you have any problem with this..

0 Kudos
Message 4 of 20
(5,104 Views)

EduU,

 

There are plenty of ways to do this, here is just one:

 

Sort positive negative array.png

 

Rgs,

 

Lucither.

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
Message 5 of 20
(5,093 Views)

G.K and Lucither could you guys make it to 8.6 LabVIEW version?

I can't use the option to take the image and put into labview.

 

But thanks for the help guys

This probably will solve my problem!

0 Kudos
Message 6 of 20
(5,088 Views)

No worries,

 

Here it is in 8.6

 

Rgs,

 

Lucither.

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 7 of 20
(5,085 Views)

if you want the ending array add a biuld array to both the cases like this:

 

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 8 of 20
(5,084 Views)
Solution
Accepted by EduU

here is my 8.6 version

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 9 of 20
(5,081 Views)

Thanks for all the solution!

I used the Harold Timmis as my solution

But all others give me a really nice feedback!

0 Kudos
Message 10 of 20
(5,057 Views)