Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 213601

Submitted on 6 Mar 2013

Incorrect

26Size
Leading solution size is 12.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
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
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
2
Fail
 
%%
M = magic(6);
thresh = 2;
[r,c]= find(magic(6) > 2)
out = [r c]
assert(isequal(RCgreaterThan(M, thresh),out))
Error: Assertion failed.