LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Number Array to Boolean Array ??

Solved!
Go to solution

Also remember that you should always operate on arrays directly and use array controls and indicators.

There is no need to have all that scalar clutter on the diagram, it just multiplies the amount and complexity of code by the array size. 🙂

Message Edited by altenbach on 05-01-2007 01:12 PM

0 Kudos
Message 11 of 24
(3,885 Views)


@TonP wrote:

Be aware that typecasting width different data sizes you can get strange results.

Ton


That is why I don't use Type Cast.  !=0 is easier, simpler, and reliable.  But still I wish there was a plain old (0,1) to Boolean function in the boolean palette, right next to the Boolean to (0,1) function.  Even if it is the exact same coding as !=0, just to have it there with its own icon in the boolean palette makes it easier on programmers, especially beginers.
- tbob

Inventor of the WORM Global
0 Kudos
Message 12 of 24
(3,880 Views)


@altenbach wrote:

There is no need to have all that scalar clutter on the diagram, it just multiplies the amount and complexity of code by the array size. 🙂



Personal preferrence.  If the number of scalars is small (5 or 6 or less) I prefer to see individual scalars.  I don't like arrays and their increment/decrement buttons.

Now here is a little trick for those who don't like clicking on the Index increment/decrement buttons.  Scrollbars on an array display:

  Maybe I should have created a nugget on this item.

 

Message Edited by tbob on 05-01-2007 02:19 PM

- tbob

Inventor of the WORM Global
0 Kudos
Message 13 of 24
(3,882 Views)

 


@tbob wrote:
But still I wish there was a plain old (0,1) to Boolean function in the boolean palette, right next to the Boolean to (0,1) function.  Even if it is the exact same coding as !=0, just to have it there with its own icon in the boolean palette makes it easier on programmers, especially beginers.

But it would not be the same! In order to be able to call it "(0,1) to Boolean", it can only accept 0 or 1 as input. We don't have a valid output defined for cases where the input is neither 0 or 1. (e.g. -1, 10000, NaN or -Inf).

The !=0 is more general.

0 Kudos
Message 14 of 24
(3,873 Views)

tbob wrote: I don't like arrays and their increment/decrement buttons.

That's why I usually hide the index terminal for smaller, fixed size arrays such as in this case. 😉
0 Kudos
Message 15 of 24
(3,869 Views)

@tbob wrote:

Now here is a little trick for those who don't like clicking on the Index increment/decrement buttons.  Scrollbars on an array display:

Maybe I should have created a nugget on this item.


Maybe you should make sure I didn't already create a nugget on this item... 😉

-D

0 Kudos
Message 16 of 24
(3,871 Views)


@Darren wrote:
Maybe you should make sure I didn't already create a nugget on this item... 😉

-D



Smarty pants Smiley Very Happy  That is probably where I got the idea in the first place.  Old age really affects memory.
- tbob

Inventor of the WORM Global
0 Kudos
Message 17 of 24
(3,868 Views)


@altenbach wrote:

But it would not be the same! In order to be able to call it "(0,1) to Boolean", it can only accept 0 or 1 as input. We don't have a valid output defined for cases where the input is neither 0 or 1. (e.g. -1, 10000, NaN or -Inf).

The !=0 is more general.




I'm just thinking of compliment functions.  There is a string to path and a path to string.  There is a Number to Boolean Array and a Boolean Array to Number.  Since there is a Boolean to (0,1) I would like to see its compliment right next to it, (0,1) to Boolean.  It could work just like !=0.  The help file could explain that any non zero input comes out True.  Sure, !=0 is more general.  But I would intend that it be just used to convert 0,1 to a boolean.  If a user wires in NaN or anything else, he is mis-using the funtion.

You can misuse the !=0 function too.  What output should you expect if you wire NaN or -Inf to the !=0 function?  It comes out True for these cases.  I guess NaN really is not zero.

- tbob

Inventor of the WORM Global
Message 18 of 24
(3,862 Views)

In general, we try to simplify the offerings on the LabVIEW palettes, just because of the sheer amount of functionality we include in LabVIEW.  For this reason alone, you would have an extremely hard time convincing the Usability experts in LabVIEW R&D to add a new primitive to the palettes that functions identically to an existing primitive.  You might consider filing a product suggestion that we add a sentence to the Help on the Boolean to (0,1) function that, if the user wants to perform the opposite conversion, he can use Not Equal to Zero.

-D

Message 19 of 24
(3,854 Views)


@tbob wrote:

I'm just thinking of compliment functions.  There is a string to path and a path to string.  There is a Number to Boolean Array and a Boolean Array to Number.  Since there is a Boolean to (0,1) I would like to see its compliment right next to it, (0,1) to Boolean.  It could work just like !=0.  The help file could explain that any non zero input comes out True.  


Just saw this thread...

I go with tbob. Smiley Wink

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 20 of 24
(3,827 Views)