02-14-2012 12:25 PM
I'm using an Agilent 34970 with a 34901A switch module. It has 16 switches going to two commons. The end function is to switch through all the sources to read resistance and voltage.
The driver and sample vi from the NI idnet were used as a base for my vi.
The sample vi uses a user-controlled 2-d boolean array (false = open). I want to be able to programmatically cycle through all the switches, but I don't know how to tell the dimensions of array I have.
I would like to go through every element of the 2nd raw for each element in the 1st row. If I could programmatically ignore elements #9, 10, 19, and 20, that would be helpful too.
Thanks for any help!
02-14-2012 12:28 PM - edited 02-14-2012 12:30 PM
Look up auto indexing tunnels. Looks like that's what you need.
Your loops will iterate through the whole array, no matter what the size. In other words, you dont have to know its dimensions.
02-14-2012 12:38 PM
What I need to do is add the programmatic counter on the front end of the vi - I don't want to use the user-selectable 2-d boolean array - I want the vi to cycle through it automatically.
This is currently NOT in the vi I attached. I'm looking for a solution.
02-14-2012 12:42 PM
I misunderstood...
02-14-2012 12:50 PM - edited 02-14-2012 12:54 PM
I have Labview 8.6 so I can't view your code, but it sounds to me that you could use a for loop to change the 2d boolean array (hide the array on the front panel, but utilize it inside the code). You don't have to use auto-indexing, but can create an array prior to starting the for loop. Lets say you want to only use outputs 1, 3, and 7... use the front panel numerical controls (or array control) to create an array with only the elements 1, 3, and 7. Then, use Array Size to set the number of iterations N of the for loop.
At each iteration of the for loop, select the appropriate element of the control array, in this case (1,3,7) to decide how the output is set. You can either do this programatically or you can create specific array constants for each output and place them into a case statement which is controlled by the number you get out of the array.
02-14-2012 12:59 PM
Another Q: in this code, the 2-d array is numbered 1-20... wouldn't that make it a 1-d array? The mismatch between the number of the switch and the array element is confusing me. I don't know how I would use a for loop for each row in the array...
Is there a way to see if I have a 2x10 or 10x2 array?
02-14-2012 01:01 PM
If you use an array size primitive on a 2D array, the output is a 2 element array.
The value of element 0 is the number of rows and the value of element 1 is the number of columns.
02-14-2012 02:09 PM
Is there a way to determine what's in the vi front panel right now? I cannot determine if it's 2x10 or 10x2... There are no properties of the 2-d array that plainly tell me.
02-14-2012 02:11 PM
What exactly do you need that the array size function does not tell you?
02-14-2012 02:18 PM
@CelerityEDS wrote:
Is there a way to determine what's in the vi front panel right now? I cannot determine if it's 2x10 or 10x2... There are no properties of the 2-d array that plainly tell me.
There is "array size" which tells you the actual size of the 2D array.
There are properties that tell you how many rows and columns are visible in the front panel array container.
There are also properties that tell which element is currently scrolled to the top left corner.
The size and index position of the front panel array control or indicator is not related to the actual array size. You can show only 2x2 elements of a 1000x1000 array or vice versa. if the container is too big, the extra elements are greyed.