Problem 2522. Convert given decimal number to binary number.
Wow mine one so much complex dont think str2num can do that
I used str2num
why 'de2bi()' & 'bi2de()' functions don't work here although they work in MATLAB online?!
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'
Why doesn't the built in function dec2bin() work here?
dec2bin returns a character vector, the answer must be an int type
Problem Recent Solvers1533
Remove the two elements next to NaN value
Back to basics - mean of corner elements of a matrix
Return fibonacci sequence do not use loop and condition
More from this Author70
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!