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: 

convert decimal to binary and also change the binary wordlength

Solved!
Go to solution

Hello all

I want to convert a decimal to a binary digit ( which i know)

BUT

i also want to dynamically change the wordlength of the binary number.

 

in the sense,

if the formula VI comes up with an answer N, i want a N digit binary number....

                      or comes up with an answer N+1, i want a N+1 digit binary number....

 

I hope you are understanding what i am trying to say...

Thanks in advance....

more kudos to give 🙂

Many more Kudos to give:)
0 Kudos
Message 1 of 8
(4,257 Views)
I don't think you can pad zeros programatically (that's what I understand you want to do). One way to get around this would be to typecast the binary value into a string and then concatenate the zeros. If I have not understood you correctly, let me know and be sure to include an example.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 8
(4,254 Views)
Solution
Accepted by nikhilvastarey

Hi there

 

i'm not sure i understood you right, but do you mean something like this ? (see attachment)

 

Message Edited by chrisger on 12-30-2008 07:16 AM
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
Download All
Message 3 of 8
(4,241 Views)

Adnan Z a écrit:
I don't think you can pad zeros programatically.
Wrong !    😉 😄   There is a property node for that !
Message Edité par chilly charly le 12-30-2008 03:02 PM
Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
Message 4 of 8
(4,230 Views)
Nik, has your question been answered? If not so, please provide some more information. I'm not sure i understood it right.
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 5 of 8
(4,226 Views)

hum... something went wrong while pasting the picture. Here is a better view...

Message Edité par chilly charly le 12-30-2008 04:06 PM
Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
Download All
Message 6 of 8
(4,216 Views)
Wow that's an elegant way of doing it. I actually didn't know that; thanks...we learn something new everyday!
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 7 of 8
(4,203 Views)

Hi Adnan,

 

Lurking on the forums is the best way to learn... by yourself : once you are fluent with LabVIEW, there are questions that sound like challenges... and lead you to dig deeper into LabVIEW.

Message Edité par chilly charly le 12-30-2008 05:40 PM
Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
0 Kudos
Message 8 of 8
(4,186 Views)