06-05-2018 07:21 AM
Hi Guys,
I'm new to LabVIEW but I'm trying to convert a 64 bit binary string of numbers to single char values. The reason for this is to compare the individual bits with another string of 64 bit values. I'm not sure if I'm going about this a very awkward way but any help would be appreciated.
06-05-2018 07:59 AM
I see you are already doing the direct comparison (Not Equal To). So what exactly are you trying to accomplish once you prove that they are different?
As far as formatting your strings, use %064b as your format if you want to see all of the bits. That will eliminate a bunch of your logic. But I feel like this is a side issue since I think you are looking to do something else in the end.
06-05-2018 08:06 AM
if you want only compare strings, use byte array (top of example)
If you need string array, you can convert like here
06-05-2018 08:07 AM
@Anto_1904 wrote:
I'm trying to convert a 64 bit binary string of numbers to single char values ... to compare the individual bits with another string of 64 bit values.
You start by doing an "Is Equal?" comparison of the two U64 integers. If they differ, then you know some bits are different. What is the next question -- do you want to know which bits are different, which bytes are different, or what? I'm assuming that the U64 isn't a concatenation of 8 8-bit Ascii (or 4 16-bit Unicode) values, but if it were, then you might want to know if the characters are different.
Let's assume your question is about "bits", and you want to know which bit positions differ. Can you think of a Boolean operation that returns True (or False) according to whether or not two bits are the same (or different)? [If the answer is "No", learn about the elementary Boolean Operators shown on the top row of the Boolean Palette]. Finally, assuming that a Boolean Operation on two U64s yields another U64, can you find a function (probably on the Boolean Palette) that might turn a number into its corresponding bits? [Hint -- "bit" is an acronym -- look up its meaning].
Bob Schor
06-05-2018 08:11 AM - edited 06-05-2018 08:12 AM
as crossrulz said, it is unclear what you want to accomplish.
i guess you want to know where the two numbers (no string inputs to be found in your VI) differ:
06-05-2018 08:51 AM
Why don't you convert it like this?
/Y
06-05-2018 08:55 AM
that little bugger "?1:0" i always forget it exists