Cody

# Problem 856. Getting the indices from a matrice

Solution 2089222

Submitted on 11 Jan 2020
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
x = [1 2 3;4 5 6;7 8 9]; thresh=5; y_correct = [3 6 8 9]; filetext = fileread('MatrixIndices.m'); assert(isequal(MatrixIndices(x, thresh),y_correct)) assert(isempty(strfind(filetext, 'find')))

Asub = -4 -3 -2 -1 0 1 2 3 4 Athresh = 2 3 1 4

Assertion failed.

2   Fail
x = 1:2:100; thresh=90; y_correct = [46 47 48 49 50]; filetext = fileread('MatrixIndices.m'); assert(isequal(MatrixIndices(x, thresh),y_correct)) assert(isempty(strfind(filetext, 'find')))

Asub = Columns 1 through 30 -89 -87 -85 -83 -81 -79 -77 -75 -73 -71 -69 -67 -65 -63 -61 -59 -57 -55 -53 -51 -49 -47 -45 -43 -41 -39 -37 -35 -33 -31 Columns 31 through 50 -29 -27 -25 -23 -21 -19 -17 -15 -13 -11 -9 -7 -5 -3 -1 1 3 5 7 9 Athresh = 1 3 5 7 9

Assertion failed.

3   Fail
x = 1:2:100'; thresh=90; y_correct = [46 47 48 49 50]; filetext = fileread('MatrixIndices.m'); assert(isequal(MatrixIndices(x, thresh),y_correct)) assert(isempty(strfind(filetext, 'find')))

Asub = Columns 1 through 30 -89 -87 -85 -83 -81 -79 -77 -75 -73 -71 -69 -67 -65 -63 -61 -59 -57 -55 -53 -51 -49 -47 -45 -43 -41 -39 -37 -35 -33 -31 Columns 31 through 50 -29 -27 -25 -23 -21 -19 -17 -15 -13 -11 -9 -7 -5 -3 -1 1 3 5 7 9 Athresh = 1 3 5 7 9

Assertion failed.