LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

boolean array to numerics

Hi, I am looking for some help in converting a boolean matrix (array) to a
numerical value. ie, row one = 0 through 19, row two = 20 through 39, etc...
I have tried many different approaches and seem to wind up with a number of
different ways to do things I don't want to do. I have to make a matrix to
select relays via GPIB addresses, each card location has 20 addressable
positions with 18 card locations ( 0 - 19, 20 - 39, 40-59,...).

thanks, in advance

Kenny
0 Kudos
Message 1 of 4
(2,791 Views)
> Hi, I am looking for some help in converting a boolean matrix (array) to a
> numerical value. ie, row one = 0 through 19, row two = 20 through 39, etc...
> I have tried many different approaches and seem to wind up with a number of
> different ways to do things I don't want to do. I have to make a matrix to
> select relays via GPIB addresses, each card location has 20 addressable
> positions with 18 card locations ( 0 - 19, 20 - 39, 40-59,...).
>

I'd recommend that you drop a For loop, and wire up the 2D array of
Booleans. It will index out each row. Multiply i times 20 and
use that to add to the result of each row. From the description, it
isn't clear whether there is only one True per row. If that it the
case, then search 1D array for True. It will return t
he index of
the element that is True, or -1 if not found. If found, then add
the index to the 20*i value. The next step is probably going to
be formatting the array of integers to a string for GPIB transmission.

Greg McKaskle
0 Kudos
Message 2 of 4
(2,791 Views)
Ken wrote:
>
> Hi, I am looking for some help in converting a boolean matrix (array) to a
> numerical value. ie, row one = 0 through 19, row two = 20 through 39, etc...
> I have tried many different approaches and seem to wind up with a number of
> different ways to do things I don't want to do. I have to make a matrix to
> select relays via GPIB addresses, each card location has 20 addressable
> positions with 18 card locations ( 0 - 19, 20 - 39, 40-59,...).
>
> thanks, in advance
>
> Kenny
Kenny,

There is another way I'm using. See attached sample.

Best Regards,
--
Sergey Krasnishov,
--------------------------------------
Automated Control Systems
National Instruments Alliance Member
Moscow, Russia
sergey_acs@levsha.ru
------------------------------
--------
0 Kudos
Message 3 of 4
(2,791 Views)
try the standard conversion vi's


Ken wrote in message ...
Hi, I am looking for some help in converting a boolean matrix (array) to a
numerical value. ie, row one = 0 through 19, row two = 20 through 39,
etc...
I have tried many different approaches and seem to wind up with a number of
different ways to do things I don't want to do. I have to make a matrix to
select relays via GPIB addresses, each card location has 20 addressable
positions with 18 card locations ( 0 - 19, 20 - 39, 40-59,...).

thanks, in advance

Kenny
0 Kudos
Message 4 of 4
(2,791 Views)