Problem 45404. ZigZag - 04
Given a matrix, print all its elements in the spiral form (clockwise direction).
For example,
a=[16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1] output = [16 2 3 13 8 12 1 15 14 4 9 5 11 10 6 7]
Solution Stats
Problem Comments
-
3 Comments
William
on 31 Mar 2020
Asif,
I think some of the solution vectors in this problem are incorrect. In problem 2, for example, all the numbers after 120 are duplicates.
Asif Newaz
on 1 Apr 2020
sorry about that..there was a bug in my code
Asif Newaz
on 1 Apr 2020
It's been fixed now
Solution Comments
Show commentsProblem Recent Solvers13
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15531 Solvers
-
Return a list sorted by number of occurrences
2778 Solvers
-
Create a cell array out of a struct
1833 Solvers
-
478 Solvers
-
Change the sign of even index entries of the reversed vector
553 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!