How to change element in base 10 to base 2 in a matrix, with loops and while
2 次查看(过去 30 天)
显示 更早的评论
Suppose i have a matrix called A,the elements ib base 10,how do i convert to base 2 .with conditions and loops.
14 个评论
Walter Roberson
2017-9-24
variable(count) = lastbit;
Yes, mod(current_num,2) is fine to extract the last bit.
回答(1 个)
Jose Marques
2017-9-9
A = magic(5) %generating a matrix 5x5
A = (A<10) %suppose you want the elements in A < 10
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!