LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert decimal to binary in Labview

Edit: Looks like Dennis beat me to it Smiley Happy

 

You realize you are replying to a five and a half year old thread?

 

But anyway are you talking about somehow wiring five booleans to the selector and typing something like '10010' into the case?

 

Capture.PNG

=====================
LabVIEW 2012


0 Kudos
Message 11 of 17
(3,646 Views)

I know the thread is old, but it was the first thing that showed up in google, and my problem was the same.

Thank you very much for the answer.

 

actualy, it's 5 digital sensors connected to my cRIO, I need different senarios for each combination.

Message 12 of 17
(3,640 Views)

Hey not a problem replying to an old thread! I didn't mean to imply otherwise and you are doing something that a lot of people do not do. You are researching before asking. Kudos for that!. I was just wondering if you saw the date Smiley Happy

=====================
LabVIEW 2012


0 Kudos
Message 13 of 17
(3,636 Views)

tbob;

 

".. any decimal number to a binary string .."   [ UNumberToBinaryString.vi  ]

 

Very useful ... just what I needed !!

Thanks

0 Kudos
Message 14 of 17
(2,856 Views)

@slbLV wrote:

tbob;

 

".. any decimal number to a binary string .."   [ UNumberToBinaryString.vi  ]

 

Very useful ... just what I needed !!


This thread seems a bit outdated, but here are two alternative that do exactly the same, but with less code. (look ma, no loops!)

 

Of course the correct way would be to create a polymorpic VI that adapts to the input type automatically. When creating the polymorphic instances, you might as well just use a diagram constant with the right format for each type.

 

 

0 Kudos
Message 15 of 17
(2,839 Views)
0 Kudos
Message 16 of 17
(1,759 Views)

Hi avinash,

 

why do you think your VI will help here?

See that small addition I made to your VI:

check.png

I just use FormatIntoString to get the very same result as your whole mess of number to boolean array and string conversion…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 17
(1,752 Views)