Richard, I think your test suite has an error in it. Both pd and pad will result in the same matrix, as they're both circshifted by [1 1-i] Will pad=fliplr(pad); after the for loop correct this problem?
Test Suite fixed. Who new that 1-i is the same as -i+1.
The circular shift should be made from first row, not the 2nd, and the "knight" always moves down from the first column of the row to the last column in an L-movement.
I had not recognized the symmetry of row and column processing. A very succinct method to create a Knight pattern.
Tic Tac Toe FTW
Get the elements of diagonal and antidiagonal for any m-by-n matrix
Make a Star Pyramid
Oh Zero Zero Zero!!!
Area of an Isoceles Triangle
Elastic Collision 001: 1-D
Genome Sequence 003: DNA Sequence with random positioned segments
Rubik's Mini Cube: Solve Randomized Cube in 11 Moves or Less; Score is by Time (msec)
USC Fall 2012 ACM : Find Largest Water Concentration
Knots Contest: Minimum Knots (ContestSuite)
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office