For example, if n=2 (maximum value), the output matrix should be
[1 1 1 1 1;
1 2 2 2 1;
1 2 1 2 1;
1 2 2 2 1;
1 1 1 1 1]
where you go from inside to outside starting from 1 to 2(maximum value) and again move back from 2 to 1.

Solution Stats

490 Solutions

159 Solvers

Last Solution submitted on Dec 16, 2025

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Group


Problem Recent Solvers159

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!