01-09-2017 04:40 PM - edited 01-09-2017 04:41 PM
Hello,
I am trying to update color boxes and text in an array from a subvi using references. Sometimes, everything works perfectly. Other times, there will be some random "default value" boxes between the [0,0] of the array and the intended output.
I've created a "simplified" .vi to illustrate the problem. The 4 arrays update from the pass/fail boolean array control. Below is the correct case:
Sometimes, the arrays calculated using the reference/index method will be offset by some amount, which is not necessarily the same between the two arrays:
As you can see, the resulting arrays are mostly correct, just shifted off the true [0,0]. I've found that editing a cell in that array will cause this issue. I'm not sure if this is the ONLY thing that causes this issue.
The result after running:
Please see attached vi for block diagram. How can I make sure my vi always uses the correct [0,0] index?
Solved! Go to Solution.
01-09-2017 05:40 PM - edited 01-09-2017 05:40 PM
Despite the name, indexVals does not select an array index. It postions the selected index to the top left corner of the control. Apparantly this actually can work for what you want, but fails once you've clicked something. You should think about preallocating data to the array (based on the size of your pass/fail input, then use Replace Array Subset to update the values.
Or you could simplify and do pretty much the same as your bottom loop, just storing to the reference value, instead of a local variable.
01-10-2017 10:41 AM
Thanks, that explains it.
I've also uploaded the new functional version of the vi.
01-10-2017 10:51 AM
That pretty much does it. That true/false condition can be simplified even further. You can take everything out of the conditional block and use Select nodes with the colors/text as the true false conditions.
BTW, the Index Array node can be expanded to return more than one index. Just click on the bottom and drag down.