How to perform cancatenation of binary numbers using matlab

here for example if we have a=1011,b=0011,c=0101 we need the cancatenated result to be A=(101100110101) what are the instruction that can be used to get this result which should be in binary format

답변 (1개)

Jos (10584)
Jos (10584) 2014년 2월 17일
If the values are stored as strings (character arrays):
a = '1011' , b = '0011', c = '0101'
out = [a b c] % simple character concatenation
If thee values are stored as numbers (doubles):
a = 11, b = 2, c = 5
tmp = dec2bin([a ; b ; c]) % concatenate and convert to binary representation
out = reshape(tmp.',1,[]) % rearrange the characters

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

질문:

2014년 2월 17일

댓글:

2014년 2월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by