Bit stream in to digits
古いコメントを表示
i have a stream of bits(1 and o), when i save these bit , like i have 128 bits, b1 contains 1 to 10 bits, b2 contain 11 to 20 and so on. Now i got a problem that when i save these bits in b1, b2 , b3 and so on. and want to retrieve, it gives value instead of binary digits, so to solve this issue, i used bitget command but it only support 52 digits, while my requirement is 128
4 件のコメント
Jos (10584)
2014 年 2 月 19 日
How is your stream of bits stored? As a string or a (logical) array of 0's and 1's? And how do you split this stream into the separate 10 bit variables?
Some example (pseudo-)code would really help!
Raza
2014 年 2 月 19 日
Jos (10584)
2014 年 2 月 19 日
Please elaborate ...
Raza
2014 年 2 月 19 日
採用された回答
その他の回答 (1 件)
Jos (10584)
2014 年 2 月 19 日
You can split the string into cells
% (smaller) example
MyStr = '10100101010101010010101010101010' ; % a string of arbitrary length
N = 5 ; % the size of each block (in your case 128).
maxN = numel(MyStr)
ix0 = 1:N:maxN
fh = @(X) MyStr(X:min((X+N-1),maxN))
B = arrayfun(fh,ix0,'un',0)
% now B{K} holds the K-th block of N bits of S
MyStrToo = cat(2,B{:})
isequal(MyStrToo, MyStr) % check!
カテゴリ
ヘルプ センター および File Exchange で String についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!