From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sudden problem with array subset replacement

Solved!
Go to solution

Hi, 

I was working on my project when suddenly a strange problem appeared.

I have an intensity graph with 2 cursors which determine the coordinates of my region of interest. I created a simple solution to get those coordinates and store them in 1D array (x0, y0, x1, y1), from which I take them later to perform some calculations. Now: it was all working fine and dandy until out of nowhere the array stopped storing those coords properly. I set a few probes and indexes of the cursors and coordinates themselves look to be aquired properly. But, for some reason, the replace array subset function stopped storing them in proper cells. Now whenever I move any cursor, its coordinates are stored in the first two cells of an array. I'm almost sure I didn't change anything in the code, so what might be the cause?

Screenshot attached.

0 Kudos
Message 1 of 6
(2,244 Views)

Something obviously has changed even if you do not recall changing anything.

 

It is difficult to troubleshoot an image. Can you post a VI showing the problem?

 

Have you gone back to a previous version of your VI to see if it is OK there?

 

Lynn

0 Kudos
Message 2 of 6
(2,228 Views)

Did you add another event case and forgot to wire the array across? Is the array tunnel leaving the event structure on the right side solid orange?

Message 3 of 6
(2,218 Views)

Yep, I added new event case previously: Cursor Grab? It was empty, so what did it change and why? I deleted the case and now it's working again.

0 Kudos
Message 4 of 6
(2,195 Views)
Solution
Accepted by topic author Oficmajster

@Oficmajster wrote:

Yep, I added new event case previously: Cursor Grab? It was empty, so what did it change and why?



If you don't wire the array across the new case, the array in the shift register will be turned into an empty array if that new cases executes. Once the array is empty, replacing elements will not increase the size of the array, it will remain empty.

Solution: wire the array across all new cases (if you create linekd input tunnels, this will even happen automatically ;))

0 Kudos
Message 5 of 6
(2,192 Views)

OK thanks a lot. I was terryfied that whole program is wrong. Simple mistake fortunately 🙂

0 Kudos
Message 6 of 6
(2,189 Views)