02-26-2009 07:51 AM
Hi,
I am trying to enter data into an array using a case statement to select the values of interest.
The problem is this, I am running a for loop, and each time it runs it reads a specific value in the existing array (Array 1), using the for loop index as the index for the Array 1. Then I check whether that specific value = a predefined value
if it does: the case statement writes the index into a new array (Array 2).
if it does not: the case statement writes a constant - i would like not to have to do this but unfortunately the case loop must have all input terminals connected.
Essentially I want Array to to consist only of the values of interest, and no default / constant values.
Any ideas?
Solved! Go to Solution.
02-26-2009 08:30 AM - edited 02-26-2009 08:33 AM
You're expecting an array with 4 elements coming out. Does it work in the picture you posted? It seems to me you would only get a 1 element array coming out because there are no shift registers or indexed tunnels. Anyway, if I understand your problem correctly you're looking for a solution like this.
02-26-2009 08:48 AM
You have 2 problems:
02-27-2009 04:01 AM
Hi,
thank you both for your prompt responses. I've implemented both your suggestions, but am still not getting the loop to work. I was wondering, if I use the build array function, does it automactically index, or is the second 'input' with the index required. The reason I ask is because when I run the vi, the index within the case loop does increase to 4, however the array that comes out of the for loop doesn't have 4 inputs at different indices i.e. after the for loop completes at index 0 it should return 325, at index 1 it should return 427 up to index 4 at which point it should return 0 as there are only 4 values written to the array.
Aaron
02-27-2009 08:39 AM
You are misusing Build Array. You wire an array into one input and other arrays or values into the others. See the example I attached.
02-27-2009 08:45 AM - edited 02-27-2009 08:47 AM
02-27-2009 08:57 AM