LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with cluster elements sum

Solved!
Go to solution

Hi

I have a problem (perhaps very simple to solve). I have a cluster with 3 integers inside. I`m building an array of these elements (after unbundling my cluster) and I want to sum all these elements. However, my result is not satisfying. For example: my array: [255,255,238] and LV shows me sum of these elements: 236. 

 

Probe 6 on my printscreen: my array

Probe 7: result of sum operation

 

What am I doing wrong? Thanks in advance

 

0 Kudos
Message 1 of 3
(2,356 Views)
Solution
Accepted by topic author e-nDrju

Your datatype seems to be U8, so the maximum value can only be 255. (It is a bit hard to read because of the image scaling). Why don't you attach the VI instead?

 

If you need the real sum, you need to convert to a different representation (e.g. U16) first.

 

Also, what is the purpose of the FOR loop? Since it only runs for one iteration, you might as well delete it.

Message 2 of 3
(2,353 Views)

How didn`t I notice that ? 🙂 Thanks a lot - I knew it was stupid.

 

And about that loop - it will be more than 1 iteration (number of snapshots taken by cam and saved to bitmap file), but I`ve changed it for a while for easier debugging.

 

Thanks once again.

0 Kudos
Message 3 of 3
(2,344 Views)