LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array changes its value without apparent reason

Solved!
Go to solution

Hi, i have been now trying to solve this problem for two days with no result.

 

I have a piece of code thats compares the last two elements of a cluster on every position of two arrays, (these are cordinates x,y) so when it finds two sets of coordinates matching, it then sets the fist element of the cluster on that position one of the of the arrays to 0 and the other to 5.

 

The problem is that when if exits the first FOR loop, it loses the value 0, and recovers the value it had before entering the loop.

 

The code:

In bpoint 25 it has 6, then in 26 turns to 0

 Picture.jpg

0 Kudos
Message 1 of 7
(2,390 Views)

Look at the timestamps on the probe: 25 was timestamped at 0:00:04 while 26 was at 0:01:24.  The False case probably executed on that last iteration.

 

Lynn

0 Kudos
Message 2 of 7
(2,387 Views)

If I understand it right, the value from the false case executed previously is copying on the same position than the result of the true case in 26. Is this a problem of synchronization?

 

In the false case there is only a wire tunneling. Any suggestion to solve this? Im new in labview.

 

Thanks

0 Kudos
Message 3 of 7
(2,380 Views)

If you put a probe on the boolean going to the case structure selector terminal (with ?), I think you will find that the last value is False.  In that situation the value on that wire tunneling through the False case will appear on the output (at probe 26). You could also put a probe on the wire in the False case - the same location as probe 25, except in the False case.  Highlight execution might be helpful but from looking at the timestamps it might be so slow as to be too annoying to be helpful.

 

Lynn

0 Kudos
Message 4 of 7
(2,375 Views)

In last iteration it executed the false case and the value for that was 6. The true case outputs a 0, but when it comes out to the for it changes to 6 again. Copying the output from the previous false case?

0 Kudos
Message 5 of 7
(2,370 Views)
Solution
Accepted by topic author Herkukeitto

No.  You misunderstand how the case structure works.  Each time it executes ONLY ONE of the cases executes. The value produced by that case is connected to the output.  The other case and the code in it does not execute at all.

 

The tutorials for Getting Started with LabVIEW are a good way to learn some of these basic features.

 

Lynn

0 Kudos
Message 6 of 7
(2,363 Views)

Oh i just found i needed a shift register. Thank you for your replies.

0 Kudos
Message 7 of 7
(2,351 Views)