there are two 8 bit binary values in a single variable...how can i concate these two values???

a='asd';
b=double(a);
c=dec2bin(b,8);
d=length(c);
i need to get d as 24 how can i get?

1 件のコメント

hemalatha
hemalatha 2014 年 12 月 17 日
thank u for your response....each 8 bit displayed in different lines(that means in the form of matrix)..i want to concate those 24 bits..how can i concate ?

サインインしてコメントする。

 採用された回答

Titus Edelhofer
Titus Edelhofer 2014 年 12 月 17 日
Hi,
concatenate them using reshape:
reshape(c', 1, numel(c))
Titus

その他の回答 (2 件)

Guillaume
Guillaume 2014 年 12 月 17 日
As per the documentation, length is the size of the largest dimension in a matrix, in your case, the number of columns, so it's 8.
To get the number of elements in a matrix, use numel, so:
d = numel(c)
Andrei Bobrov
Andrei Bobrov 2014 年 12 月 17 日
編集済み: Andrei Bobrov 2014 年 12 月 17 日
on comment by Hemalatha
a='asd';
b=double(a);
c=dec2bin(b,8).';
out = c(:)';

カテゴリ

ヘルプ センター および File ExchangeMultidimensional Arrays についてさらに検索

質問済み:

2014 年 12 月 17 日

コメント済み:

2014 年 12 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by