Cody

# Problem 44102. Stop a ZigZag scanning N*N Matrix at any diag you want

Solution 1540510

Submitted on 25 May 2018 by J. S. Kowontan
• Size: 43
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = 1; n=1; y_correct = 1; assert(isequal(stop_zig(x,n),y_correct))

2   Pass
x =[1 2 3; 4 5 6; 7 8 9]; n=3; y_correct = [ 1 2 4 7 5 3]; assert(isequal(stop_zig(x,n),y_correct))

3   Pass
x =[1 2 3; 4 5 6; 7 8 9]; n=-3; y_correct = [ 9 8 6 3 5 7]; assert(isequal(stop_zig(x,n),y_correct))

4   Pass
x =[1 2 3; 4 5 6; 7 8 9]; n=2; y_correct = [ 1 2 4]; assert(isequal(stop_zig(x,n),y_correct))

5   Pass
x =[1 2 3 4; 4 5 6 7; 7 8 9 10; 10 11 12 13]; n=-3; y_correct = [ 13 12 10 7 9 11]; assert(isequal(stop_zig(x,n),y_correct))

### Community Treasure Hunt

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

Start Hunting!