How to combine 8-bit binary sequence?
古いコメントを表示
I have a matrix like this: A = ['00001110' '00001110' '00001110' '00001110']; I want to combine them to one sequence like this: B = [ 00001110000011100000111000001110 ];
any idea? thanks a lot
2 件のコメント
Guillaume
2014 年 10 月 14 日
Actually, you haven't got a matrix like this:
A = ['00001110' '00001110' '00001110' '00001110'];
because if you were to write that into matlab. The result would be what you want already:
>> A
A =
00001110000011100000111000001110
Most likely, you have an array like this:
A = {'00001110' '00001110' '00001110' '00001110'};
%Note the use of } instead of ]
which is a cell array and not a matrix. They're two very different things.
The two answers you've got both assume you have a cell array.
Stephen23
2014 年 10 月 14 日
Is B supposed to be a string?
回答 (2 件)
Star Strider
2014 年 10 月 14 日
Easiest way:
A = ['00001110' '00001110' '00001110' '00001110'];
B = strrep(A, ' ', '');
produces:
B =
00001110000011100000111000001110
Andrei Bobrov
2014 年 10 月 14 日
編集済み: Andrei Bobrov
2014 年 10 月 14 日
A = {'00001110' '00001110' '00001110' '00001110'};
B = cat(2,A{:});
or
B = [A{:}];
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!