Convey binary sting into 2 bits format
I had an binay values file in matrix format . Eg [101101110111010, 111111111111111,010011110101111] . I want to seperate 15bits each into 2 bits and write it in other file in decimal format
5 件のコメント
- How are the numbers represented in MATLAB?
- Are the numbers odd width? If yes, to what width should they be padded? 16? 48?
- Are these signed or unsigned values?
- Should they be converted into "decimal format" as shown?
- How is the output file to be formatted? CSV? Text? Something else? Delimiters? Be specific.
回答 (1 件)
11111111111111111111110000011120101111000111100000 (48 bytes)
MATLAB is going to treat this as a decimal number, in double precision. Unfortunately double precision numbers only get up to roughly 10^15 (15 digits) before they start to lose precision. Only roughly the first 15 digits will be preserved ,and the rest will be the closest representable number.
There is no way around this problem as long as you insist on double precision representation.
If you were to instead code
0b11111111111111111111110000011110101111000111100000
then matlab would know to use a binary representation, in this case a uint64 number. The limit however would be 63 or 64 bits of data.
1 件のコメント
参考
カテゴリ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!