Cody

# Problem 43117. 2D Indexes

Solution 998059

Submitted on 6 Oct 2016
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   Fail
P = 1; y_correct =[0,0]; assert(isequal(index2(P),y_correct))

Error using VisibleTest1 (line 3) Output argument "indexes" (and maybe others) not assigned during call to "index2".

2   Fail
P = 2; y_correct =[0,0;1,0;0,1]; assert(isequal(index2(P),y_correct))

Error using VisibleTest2 (line 3) Output argument "indexes" (and maybe others) not assigned during call to "index2".

3   Fail
P=3; y_correct=[0, 0;... 1, 0;... 0, 1;... 2, 0;... 1, 1;... 0, 2;... ]; assert(isequal(index2(P),y_correct))

Error using VisibleTest3 (line 9) Output argument "indexes" (and maybe others) not assigned during call to "index2".

4   Fail
P=5; y_correct=[0, 0;... 1, 0;... 0, 1;... 2, 0;... 1, 1;... 0, 2;... 3, 0;... 2, 1;... 1, 2;... 0, 3;... 4, 0;... 3, 1;... 2, 2;... 1, 3;... 0, 4;... ]; assert(isequal(index2(P),y_correct))

Error using VisibleTest4 (line 18) Output argument "indexes" (and maybe others) not assigned during call to "index2".

### Community Treasure Hunt

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

Start Hunting!