This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
But you can't rely on x always being a magic square - that's just an accident of the inadequate test suite, isn't it? So although this *looks* like a good solution, it isn't really. I think it's bad practice to take advantage of an inadequate test suite.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!