How Indexing Works for Replace Array Subset Function

Updated Aug 18, 2023

Reported In

Software

  • LabVIEW
  • LabVIEW NXG

Issue Details

What is the default behavior when there are multiple unwired indexes in the Replace Array Subset.vi? 

Solution

If you are replacing multiple elements or sub-arrays using this function and not wiring the index input, the default behavior starts to replace elements at index 0 and continues from there. If you specify the first index but not the next ones, the function will continue consecutively from the last specified index. 

The figure below further illustrates this behavior. In this example, the original array contains all 7's. On the replace array subset function, the first index is set to "2" and the first new element is set to "3". In the resulting array, you can see that the element at index "2" has now been replaced by the new element "3". The second index input is left unwired while the new element input is set to "0". This would mean that the function will continue consecutively from the last specified index which would cause it to use the index "3" and replace the element at that index with the element "0". This can also be observed from the resulting array.