Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1471
Number of posts: 2147

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Binary Inputs Posted by hamzaaaa on 10 Mar 2009 at 6:49 PM
Hi

Can someone tell me how can I make a binary variable or a vector instead of decimal?
For eg. can I make a binary variable like:
A= [1 0 1 0]; ??

for a 32-bit integer.

Thanks in advance
Regards
Hamza
Report
Re: Binary Inputs Posted by giug on 10 Mar 2009 at 11:56 PM
You can define a decimal value and then convert to binary with the function dec2bin.
For example:

b=7;
A=dec2bin(b);





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.