Cody

# Problem 646. Getting the row and column location from a matrix

Solution 1120841

Submitted on 11 Feb 2017 by Jihye Sofia Seo
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
M = magic(5); thresh = 4; [r,c]= find(magic(5) > 4) out = [r c] assert(isequal(RCgreaterThan(M, thresh),out))

r = 1 2 4 5 1 2 3 4 5 2 3 4 5 1 2 3 4 1 2 3 5 c = 1 1 1 1 2 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 out = 1 1 2 1 4 1 5 1 1 2 2 2 3 2 4 2 5 2 2 3 3 3 4 3 5 3 1 4 2 4 3 4 4 4 1 5 2 5 3 5 5 5 ind = 1 2 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 21 22 23 25 ind = 1 2 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 21 22 23 25 R = 5 C = 5 c = 1 1 1 1 2 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 r = 1 2 4 5 1 2 3 4 5 2 3 4 5 1 2 3 4 1 2 3 5 out = 1 1 2 1 4 1 5 1 1 2 2 2 3 2 4 2 5 2 2 3 3 3 4 3 5 3 1 4 2 4 3 4 4 4 1 5 2 5 3 5 5 5

2   Pass
M = magic(6); thresh = 2; [r,c]= find(magic(6) > 2) out = [r c] assert(isequal(RCgreaterThan(M, thresh),out))

r = 1 2 3 4 5 6 2 3 4 5 6 1 2 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 c = 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 out = 1 1 2 1 3 1 4 1 5 1 6 1 2 2 3 2 4 2 5 2 6 2 1 3 2 3 4 3 5 3 6 3 1 4 2 4 3 4 4 4 5 4 6 4 1 5 2 5 3 5 4 5 5 5 6 5 1 6 2 6 3 6 4 6 5 6 6 6 ind = 1 2 3 4 5 6 8 9 10 11 12 13 14 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 ind = 1 2 3 4 5 6 8 9 10 11 12 13 14 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 R = 6 C = 6 c = 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 r = 1 2 3 4 5 6 2 3 4 5 6 1 2 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 out = 1 1 2 1 3 1 4 1 5 1 6 1 2 2 3 2 4 2 5 2 6 2 1 3 2 3 4 3 5 3 6 3 1 4 2 4 3 4 4 4 5 4 6 4 1 5 2 5 3 5 4 5 5 5 6 5 1 6 2 6 3 6 4 6 5 6 6 6