LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Labjack T7 writing to array elements

Highlighted

I'm struggling to write to array elements.
I've got a boolean switch array that I'd like to convert to a double array and move to the 3rd element of a 2D array.  I'm going to attach a file and see if I can get a point in the right direction.

0 Kudos
Message 1 of 4
(82 Views)

Your question makes no sense. You have eight booleans (8 bits of information) and every element of a DBL array contains 64bits.

 

You cannot "put booleans into a DBL array", whatever that means. Type mismatch!

There is no third element in a 2D array. You need to specify row and column.

You talk about "convert", but you don't specify the conversion rules.

 

(Also: are you aware that index array is resizeable? We don't have your driver subVIs, so we cannot look at all of the code)


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 2 of 4
(53 Views)

I think I can clarify this a bit:

 

 

> You cannot "put booleans into a DBL array", whatever that

> means. Type mismatch!

 

We have a function where you pass a 2D array of values.  Each row of the array is associated with a starting register (address) and then there can be one or more consecutive registers in that row.

 

https://labjack.com/support/software/api/ljm/function-reference/ljmenames

 

This is the most generic function we have and can write/read any type of register ... various integer or floating point types.  So each value is defined as a double as that has enough bits to hold all types.  In this case, I believe Marc has a row that is boolean registers.  Even though each element is a double, he is just writing a 0 or 1 to each element.

 

 

> There is no third element in a 2D array. You need to specify row and column.

 

I suspect he meant 3rd "row".

 

Each row can have a different number of elements (i.e. active columns), as defined by the 1D array aNumValues.  In LabVIEW the 2D array is square, so the number of columns is dictated by Max(aNumValues), and other rows have junk elements to fill in the square array as needed.

 

0 Kudos
Message 3 of 4
(40 Views)

This

Basically a 1 or a 0 in each value in the third row controls a register that is written to that flips on and off relays that then cause solenoids, etc to function. 
Writing a 1 or a 0 in the array manually causes the operations to happen, but I need to insert those values from other places to automate a small process.

0 Kudos
Message 4 of 4
(21 Views)