How to change element in base 10 to base 2 in a matrix, with loops and while
2 views (last 30 days)
Show older comments
Suppose i have a matrix called A,the elements ib base 10,how do i convert to base 2 .with conditions and loops.
14 Comments
Walter Roberson
on 24 Sep 2017
variable(count) = lastbit;
Yes, mod(current_num,2) is fine to extract the last bit.
Answers (1)
Jose Marques
on 9 Sep 2017
A = magic(5) %generating a matrix 5x5
A = (A<10) %suppose you want the elements in A < 10
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!