LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace Array Subset Operation

Solved!
Go to solution

I have some code with a VI Key Down event that toggles visibility of some indicators in response to pressing function keys. Using Boolean shift registers, the code was working with a couple of indicators.

 

To scale to a large number of indicators, I decided that I'd need to convert to a single Boolean array shift register.

 

With the Boolean array shift register, for a given function key, the code inverts a Boolean from the array for the Visible property node, then replaces the same element in the Boolean array with the inverted Boolean. The code isn't working. Once the indicator is visible, it won't go invisible on the next button push.

 

I watched execution, displaying values. It looks like the Replace Array Subset VI isn't replacing the Boolean with the updated value. In the attached screenshot, you can see where I retrieved the element from the array after it was "updated" by Replace Array Subset VI. Couldn't find any related bugs in the LV2013 bug list.

 

See the attached screenshot. What's wrong with this code? Apologies for the resolution of the screenshot. If necessary, I'll go back to the lab and try to capture a higher resolution screenshot.

Jeffrey Bledsoe
Electrical Engineer
0 Kudos
Message 1 of 6
(4,961 Views)

Maybe it's a race condition?

Jeffrey Bledsoe
Electrical Engineer
0 Kudos
Message 2 of 6
(4,951 Views)
Solution
Accepted by topic author MinerHokieRamp

From your screen shot your boolean arrayis empty, that is, it has no elements. Replace array subset will not work with an empty array.

 

Cheers,

mcduff

0 Kudos
Message 3 of 6
(4,942 Views)

@MinerHokieRamp wrote:

I If necessary, I'll go back to the lab and try to capture a higher resolution screenshot.


No, screenshots are useless, because we cannot tell what's in the other event cases for example. Simply attach the actual VI.

 

Yes, as has been mentioned, your execution highlighting shows that the boolean array is empty. You cannot replace something that is not there! It is difficult to tell how the code is organized, but I assume there is some initialization event case that is supposed to populate the boolean array. Is there? In that case, you need to ensure that things execute in the correct order.

0 Kudos
Message 4 of 6
(4,916 Views)

@mcduff wrote:

From your screen shot your boolean arrayis empty, that is, it has no elements. Replace array subset will not work with an empty array.

 

Cheers,

mcduff


Thanks. I created an array indicator and initialized it in the prior frame, then used a local variable at the input to the shift register. I could have filled the constant with False Booleans. I remember seeing the "#0" indication on the array and was thinking it had something to do with index 0. My face was red.

 

Sorry that I'm not allowed to post the actual VI. I'm glad you could interpret the low rez screenshot.

Jeffrey Bledsoe
Electrical Engineer
0 Kudos
Message 5 of 6
(4,900 Views)

@MinerHokieRamp wrote:

Thanks. I created an array indicator and initialized it in the prior frame, then used a local variable at the input to the shift register. 


 

Why a local variable? Just use a wire! No indicator or local variable needed.

0 Kudos
Message 6 of 6
(4,892 Views)