Problem 45453. Spiral Out - 02
An array is given. Convert it into a spiral matrix.
For example, a=1:27;
out=[21 22 23 24 25 26
20 7 8 9 10 27
19 6 1 2 11 0
18 5 4 3 12 0
17 16 15 14 13 0
0 0 0 0 0 0]
add necessary amount of zeros to fill in the remaining positions.
Note - spiral() is forbidden.
Solution Stats
Problem Comments
-
1 Comment
Dyuman Joshi
on 10 Apr 2022
If you are banning a certain inbuilt function, either mentioned it in the problem statement or put it up in the 1st test case. So that users won't waster their time coming up with solutions involving those functions.
Solution Comments
Show commentsProblem Recent Solvers10
Suggested Problems
-
Sort a list of complex numbers based on far they are from the origin.
5412 Solvers
-
Renaming a field in a structure array
1383 Solvers
-
Create a cell array out of a struct
1491 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
9589 Solvers
-
118 Solvers
More from this Author165
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!