Azzera filtri
Azzera filtri

Manipulate binary element in matrix

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

KALYAN ACHARJYA
KALYAN ACHARJYA il 6 Lug 2019
Modificato: KALYAN ACHARJYA il 6 Lug 2019
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 Commento
zahrein yaacob
zahrein yaacob il 9 Lug 2019
Thank you very much.
To understand further, how does bin_data=A-'0' can make it as a built array element.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Types in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by