-
3 Comments
I've just solved this problem by the code that "A=(dec2bin(0:2^n-1)-48);" How it could be that the size of leading solution is 9,but mine is 21 !?
could you pls explain the "-48" to me? i see what it does, but dont know why...
fkk,
There is a regexp() trick that some people use to produce very small sized answers. However, they do not necessarily produce a correct solution to the real world problem. I tend to proud that my answers correctly solve the problem, regardless of their size. It is a shame that the regexp() exploit is not discouraged.
Michael Bohm,
When using a numerical operator against a character vector, MATLAB interprets the char-vec as a numerical vector with values that correspond to the ASCII values. As such, the ASCII values can be passed through the char() function to produce the original char-vec. i.e. ---> char('Some Text'+1) = 'Some Text'
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!