Problem 2522. Convert given decimal number to binary number.
Solution Stats
Problem Comments
Solution Comments
-
2 Comments
Tran Tran
on 7 Mar 2022
Wow mine one so much complex dont think str2num can do that
George Iskander
on 30 Apr 2022
I used str2num
-
1 Comment
fatima alansari
on 24 Nov 2020
why 'de2bi()' & 'bi2de()' functions don't work here although they work in MATLAB online?!
-
1 Comment
Jimmy Sølvsteen Nielsen
on 8 Jun 2020
whereas str2double(dec2bin(x) succeeds, I dont agree it is correct.
str2double(dec2bin(10)) -> 1010
str2double(dec2bin(10)) + 2 -> 1012 ;
this makes little sense in decimal nor in binary code.
I suggest correcting the check to y_correct ='1010'
-
2 Comments
Sariha Azad
on 11 Jun 2019
Why doesn't the built in function dec2bin() work here?
syed rahim
on 21 Jun 2019
dec2bin returns a character vector, the answer must be an int type
Problem Recent Solvers1482
Suggested Problems
-
1315 Solvers
-
6205 Solvers
-
451 Solvers
-
451 Solvers
-
What is Sum Of all elements of Matrix
373 Solvers
More from this Author70
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!