Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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 ]
Wenlong

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
Wenlong



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.