Problem 42083. Ring Matrix
Given n (only odd), return output matrix a that has concentric rings of the numbers 1 through (n+1)/2 around the center point.
For n = 3,
a = [2 2 2;
2 1 2;
2 2 2;]
For n = 5,
a = [3 3 3 3 3;
3 2 2 2 3;
3 2 1 2 3;
3 2 2 2 3;
3 3 3 3 3;]
Solution Stats
Problem Comments
-
3 Comments
Andrew Stamps
on 22 Apr 2015
Looks like the test suite could use some work.
goc3
on 30 Sep 2016
This problem has been updated and corrected.
Peng Liu
on 1 Oct 2016
Hi Grant, it is nice to see that your are now maintaining all Cody problems. Cheers!
Solution Comments
Show commentsProblem Recent Solvers28
Suggested Problems
-
given 3 sides, find area of this triangle
811 Solvers
-
Who knows the last digit of pi?
679 Solvers
-
Make a run-length companion vector
648 Solvers
-
Given a matrix, swap the 2nd & 3rd columns
1215 Solvers
-
533 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!