From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2's compement in labview

Have some problems in converting string to binary values using 2's complement. managed to convert number to binary all values are in 1's complement..

anyone can help pls?
0 Kudos
Message 1 of 3
(2,528 Views)
Let me see if I got you right. You have a "110101..." string you want to translate to a 2's complement binary number, right? Which method are you using now?
You can use scan from string to do this, but you have to configure everything properly. The fromat should be %b, and you need to wire a constant I8, I16 or I32 into the type to make sure you can have the negative numbers as well. Just wire a constant and change its represntation. Make sure your indicator has an I representation as well.
If this doesn't help, write some more about what kind of string you're inputting and what you expect to come out of the conversion.

___________________
Try to take over the world!
Message 2 of 3
(2,508 Views)
Hi,
From what i could get out of your question are looking for how to find the 2's complement of a number in Labview,
Well then you can make use of the Number to boolean array ,this will give you the 2's complement of the number.
Sorry if i have misunderstood your question.
cheers
vicky
0 Kudos
Message 3 of 3
(2,502 Views)