Unwind the spiral

Given an m×n matrix, treat it as a spiral of values. Output it as a single array listing the values from the outer winding to the inner winding in a clockwise direction.

It may be helpful to use a function from the previous exercise.




Demo:

Enter a matrix: