LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically Cycle through Boolean Array

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!

0 Kudos
Message 1 of 12
(1,432 Views)

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.

0 Kudos
Message 2 of 12
(1,430 Views)

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.

0 Kudos
Message 3 of 12
(1,426 Views)

I misunderstood...

0 Kudos
Message 4 of 12
(1,420 Views)

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.

 

 

0 Kudos
Message 5 of 12
(1,416 Views)

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?

0 Kudos
Message 6 of 12
(1,408 Views)

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.

0 Kudos
Message 7 of 12
(1,405 Views)

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.

0 Kudos
Message 8 of 12
(1,393 Views)

What exactly do you need that the array size function does not tell you?

0 Kudos
Message 9 of 12
(1,391 Views)

@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. 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 10 of 12
(1,387 Views)