05-01-2007 03:09 PM - edited 05-01-2007 03:09 PM
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
05-01-2007 03:12 PM
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.
@TonP wrote:
Be aware that typecasting width different data sizes you can get strange results.
Ton
05-01-2007 03:18 PM - edited 05-01-2007 03:18 PM
@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
05-01-2007 03:19 PM
@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.
05-01-2007 03:23 PM
tbob wrote: I don't like arrays and their increment/decrement buttons.
05-01-2007 03:25 PM
05-01-2007 03:28 PM
05-01-2007 03:41 PM
@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.
05-01-2007 03:46 PM
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
05-02-2007 08:34 AM
@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.