Cody

# Problem 45399. ZigZag - 01

Solution 2193604

Submitted on 5 Apr 2020 by Jiahang Li
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
a = magic(4); y=[16 2 3 13 10 7 4 14 15 1]; assert(isequal(z_mat(a),y))

ans = 16 2 3 13 10 7 4 14 15 1

2   Pass
a = ones(77); y=ones(1,229); assert(isequal(z_mat(a),y))

ans = Columns 1 through 29 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 30 through 58 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 59 through 87 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 88 through 116 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 117 through 145 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 146 through 174 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 175 through 203 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 204 through 229 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

3   Pass
a = eye(7); y=[1,zeros(1,8),1,zeros(1,8),1]; assert(isequal(z_mat(a),y))

ans = 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1

4   Pass
a=[32 1 3 3;3 3 3 3;56 3 54 344;0 654 2 1]; y=[32 1 3 3 3 3 0 654 2 1]; assert(isequal(z_mat(a),y))

ans = 32 1 3 3 3 3 0 654 2 1

5   Pass
a = [101 101;101 101]; assert(isequal(z_mat(a),a(:)'))

ans = 101 101 101 101

### Community Treasure Hunt

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

Start Hunting!