uint32 and uint64 binary display
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
When using the uint32 and uint64 command as in
Answer = uint32(137)
I still get 137 back and not a binary number 32 bits long. Is there a way to output a 32 bit or a 64 bit binary number which I can then perform operations on and get a binary number returned?
Thanks
0 Commenti
Risposte (2)
Walter Roberson
il 14 Mar 2012
No.
There are a few commands such as bin2dec() and dec2bin(), but there are no other MATLAB routines defined on strings or numeric vectors that happen to represent binary.
The binary operations such as bitxor() work on unsigned integers or arrays of unsigned integers.
uint32(137) does not mean that the value 137 is to be represented as a 32 bit binary string: uint32(137) means that the value is to be treated as an unsigned integral datatype consisting of 32 total bits. "integral datatype" just like Fortran's INTEGER or C's int .
0 Commenti
Jan
il 15 Mar 2012
uint32(137) does reply a binary 32 bit value. It is only displayed as a decimal when printed to a file or the command line. You can perform operations on this value as expected:
disp(uint32(137) - uint32(1000))
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Type Conversion in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!