test cases imply that the question title should be "spot the square"
I added a rectangular (non-square) test case. Thanks for the note.
This is a good answer. I changed the test suite so that you wouldn't have to deal with logical input matrices. Sorry about that!
This code is referenced in the following blog post: http://blogs.mathworks.com/community/2015/01/19/robot-game-playing-in-matlab-part-2/
Find the sum of the elements in the "second" diagonal
994 Solvers
Return the first and last character of a string
3447 Solvers
Matrix which contains the values of an other matrix A at the given locations.
214 Solvers
Create an n-by-n null matrix and fill with ones certain positions
268 Solvers
Relative ratio of "1" in binary number
392 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!