How to remove leading zeros in decimal representation?
Show older comments
A = [23, 15, 256, 75];
B= dec2bin(A)
B =
4×9 char array
'000010111'
'000001111'
'100000000'
'001001011'
But I'm interested in output B as;
10111
1111
100000000
1001011
I want to remove leading zeros?
Accepted Answer
More Answers (1)
Hi!
Use str2num.
A = [23, 15, 256, 75];
B= dec2bin(A)
B = str2num(B)
Hope this helps
1 Comment
Noor Fatima
on 10 Aug 2022
Categories
Find more on Whos 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!