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'
function y = dec_bin(x)
y = str2num(dec2bin(x));
end
Why doesn't the built in function dec2bin() work here?
dec2bin returns a character vector, the answer must be an int type
Convert a vector into a number
503 Solvers
278 Solvers
Piecewise linear interpolation
299 Solvers
Create an index-powered vector
353 Solvers
Find out sum of all elements of given Matrix
349 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!