The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: How to get binary representation of a decimal number
Replies: 1   Last Post: Nov 30, 2012 9:49 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 51
Registered: 3/2/12
How to get binary representation of a decimal number
Posted: Nov 30, 2012 5:43 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi, all

I am looking for a method that can convert a decimal number to binary vector. I know there are many answers that I can google it, but seems there's nothing fits my problem.

I need to convert a decimal number (can be both positive or negative, and has a long string after decimal point) into binary. And at some point, I have to convert the binary strings back to decimal numbers.

I've found a function ?dec2bin?, but seems it just convert the integer part, for instance, the result of dec2bin(1.87) is 1.

May I know if there's any functions that can help me?

Thank you very much.

Best regards

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.