how to change the bit of any matrix?

2 vues (au cours des 30 derniers jours)
Sultan Mehmood
Sultan Mehmood le 1 Juil 2019
A=[12 32 ;23 14];
>> D=A(:)';
>> S=de2bi(D);
>> S=de2bi(D)
S =
0 0 1 1 0 0
1 1 1 0 1 0
0 0 0 0 0 1
0 1 1 1 0 0
>> i want to make its 4th bit zero.. so what will i do?

Réponse acceptée

Jan
Jan le 1 Juil 2019
Modifié(e) : Jan le 1 Juil 2019
A = [12, 23, 32, 14];
B = bitset(A, 4, 0)
Or:
S = de2bi(A);
S(:, 4) = 0;

Plus de réponses (1)

Shameer Parmar
Shameer Parmar le 1 Juil 2019
try with this..
S(:,4) = 0

Community Treasure Hunt

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

Start Hunting!

Translated by