MATLAB Answers

0

how to change the bit of any matrix?

Asked by Sultan Mehmood on 1 Jul 2019
Latest activity Answered by Shameer Parmar on 1 Jul 2019
Accepted Answer by Jan
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?

  0 Comments

Sign in to comment.

2 Answers

Answer by Jan
on 1 Jul 2019
Edited by Jan
on 1 Jul 2019
 Accepted Answer

A = [12, 23, 32, 14];
B = bitset(A, 4, 0)
Or:
S = de2bi(A);
S(:, 4) = 0;

  0 Comments

Sign in to comment.


Answer by Shameer Parmar on 1 Jul 2019

try with this..
S(:,4) = 0

  0 Comments

Sign in to comment.