Manipulate binary element in matrix

1 回表示 (過去 30 日間)
zahrein yaacob
zahrein yaacob 2019 年 7 月 6 日
コメント済み: zahrein yaacob 2019 年 7 月 9 日
Hi If i have binary digits in the element.How do i choose element bit 5 to bit 8.
A= 010101010
This A is in binary format.

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 7 月 6 日
編集済み: KALYAN ACHARJYA 2019 年 7 月 6 日
bin_num=str2num(A);
bin_array=num2str(bin_num)-'0';
bits_selection=bin_array(5:8)
or
bin_data=A-'0'
bits_selection=bin_data(5:8)
  1 件のコメント
zahrein yaacob
zahrein yaacob 2019 年 7 月 9 日
Thank you very much.
To understand further, how does bin_data=A-'0' can make it as a built array element.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by