datahex = sprintf('%02x', T1)??
Show older comments
T1 =00111001 10001010 01011001 1011010010101100000000000100100011010001010110011110001001101010111100110111101111
datahex =
30303131313030312031303030313031302030313031313030312031303131303130303130313031313030303030303030303030313030313030303131303130303031303130313130303131313130303031303031313031303130313131313030313130313131313031313131
T1=[T1 count]
datahex = sprintf('%02x', T1)
I don't know why output in that format],T1 is character
Accepted Answer
More Answers (1)
Geoff Hayes
on 16 Jan 2015
Edited: Geoff Hayes
on 16 Jan 2015
0 votes
Radwa - your T1 is a string of characters, so the zeros and ones are characters. The ASCII code for a character 0 and character 1 is 48 and 49 respectively. The hexadecimal equivalent of each is 30 and 31, so your above answer makes sense. (The 29 would be for the space character.)
2 Comments
Radwa
on 16 Jan 2015
Geoff Hayes
on 16 Jan 2015
I don't understand your format. How does your input string translate to that? There are limitations to the size of integers that you can use with these functions, and if you insist on using 128 bits, you may need to create a class that can handle a data type of that size.
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!