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

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
Stephen23 2014년 10월 14일
Is B supposed to be a string?

댓글을 달려면 로그인하십시오.

답변 (2개)

Star Strider
Star Strider 2014년 10월 14일

0 개 추천

Easiest way:
A = ['00001110' '00001110' '00001110' '00001110'];
B = strrep(A, ' ', '');
produces:
B =
00001110000011100000111000001110
Andrei Bobrov
Andrei Bobrov 2014년 10월 14일
편집: Andrei Bobrov 2014년 10월 14일

0 개 추천

A = {'00001110' '00001110' '00001110' '00001110'};
B = cat(2,A{:});
or
B = [A{:}];

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

Hao
2014년 10월 14일

댓글:

2014년 10월 14일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by