LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Add Array Elements

I am having problems with the Add Array Elements VI. The array is a I16, and it has no negative numbers, but when I use the Add Array Elements I get a negative sum? I am attaching the code with an array constant that shows the min value in the array, and gives the negative sum. Thank you in advance.
0 Kudos
Message 1 of 4
(3,020 Views)
The problem is that an I16 can only has a range or -32767 to 32767. You are summing a huge array are are going over that limit. If you change everything to an I32, you see that the sum is 43200.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 2 of 4
(3,012 Views)
Thanks Ed. I am still having problems though? I changed the array to I32, but I still get the same result. I am attaching the code with the array changed to I32. Does it matter that the original I16 array was created by IMAQ ImageToArray, and the array are I16 image pixels?
0 Kudos
Message 3 of 4
(3,001 Views)
You also need to change the indicator from the Add Array Elements to an I32 so it can handle a number larger than 32767.

Since you are dealing with such large numbers, you could try just using the "Image Pixels (Float)" output terminal on the "IMAQ ImageToArray.vi". Using the "To Long Integrer" function copies the array to make a new one with the new representation. If you started out with a floating point number, you would not have to do any converting.

Ed

Message Edited by Ed Dickens on 06-02-2005 02:27 PM

Message Edited by Support on 06-02-2005 04:43 PM



Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 4 of 4
(2,999 Views)