01-31-2022 05:03 AM
Dear all,
Whenever I use the Replace Array Subset function and one of the last elements is missing (like in a Cursor List) the function does nothing (this is intended by LabView). But I really would like to insert this element into the desired position. So I make a subvi doing it: Checking the size, filling in the missing elements and then replacing it as I intended. And a week later I have the same problem with a different array data structure and can build a new subvi or add a polymorphic case....
May I wish for an option in the Replace Array Subset vi to allow this? Or am I doing it wrong?
Solved! Go to Solution.
01-31-2022 05:21 AM
Hi Dom,
@DomLabView wrote:
May I wish for an option in the Replace Array Subset vi to allow this? Or am I doing it wrong?
How often do you need to replace non-existing array elements?
And why do you access them by using a fixed index?
Hint: When using autoindexing loops you almost never need to use ReplaceArrayElements…
01-31-2022 05:29 AM
If you really need this, you can make a mallable vi that can accept any type of array. This way you don't have to make a new sub VI for each type of data. See attached for a simple example
01-31-2022 05:51 AM
Thanks a lot!
I never stumbled across those malleable vis. What a tremendous new power....
01-31-2022 05:57 AM
If you often use arrays in which not all indices are occupied, you can also think about other data structures like Sets/Maps (since LV2019) or the usual variant attributes. Then you can also use strings or other types as an index