Problem 364. Matrix spiral

Make a spiral in a (n*n) matrix. The spiral has to start in the top left, and has to rotate clockwise to the center. The spiral has to have a padding of zeros between itself.

The (n*n) matrix is filled with zeros except for the spiral, that has to be made of 11 (elevens, for visual reference). The final matrix has to have the same or more zeros than elevens.

Example: n=8

A =

    11    11    11    11    11    11    11    11
     0     0     0     0     0     0     0    11
     0     0    11    11    11    11     0    11
     0     0    11     0     0    11     0    11
     0     0    11     0    11    11     0    11
     0     0    11     0     0     0     0    11
     0     0    11    11    11    11    11    11
     0     0     0     0     0     0     0     0

Solution Stats

40.24% Correct | 59.76% Incorrect
Last Solution submitted on Oct 30, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers83

Suggested Problems

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!