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일

1 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by