Was able to reduce size a few times and finally got to this solution by borrowing tricks used by Grzegorz Knor and Dan.
Tim,
Can you explain what the +'01'-'0' is doing? I don't see how i+'01'-'0'=[i,i+1].
Thanks
'01 ' is a char vector of 2 positions: '0' ans '1'.
If you subtract '0' to it, it results a char vector with characters 0 and 1.
So '01'-'0' is the same as [0 1], but because of the '[]', it cost less operations.
How to find the position of an element in a vector without using the find function
2477 Solvers
Get the length of a given vector
3566 Solvers
How long is the longest prime diagonal?
338 Solvers
262 Solvers
Find the dimensions of a matrix
372 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!