Test  Status  Code Input and Output 

1  Pass 
out = [3 4];
vec = [11 22 33 44];
thresh = 25;
assert(isequal(findIndices(vec, thresh),out))
x =
1×4 logical array
0 0 1 1
out =
[]
n =
1
n =
2
n =
3
out =
3
n =
4
out =
3 4
n =
5

2  Pass 
out = [1 2];
vec = [33 44 11 22];
thresh = 25;
assert(isequal(findIndices(vec, thresh),out))
x =
1×4 logical array
1 1 0 0
out =
[]
n =
1
out =
1
n =
2
out =
1 2
n =
3
n =
4
n =
5

3  Pass 
out = 5:10;
vec = 10:10:100;
thresh = 45;
assert(isequal(findIndices(vec, thresh),out))
x =
1×10 logical array
0 0 0 0 1 1 1 1 1 1
out =
[]
n =
1
n =
2
n =
3
n =
4
n =
5
out =
5
n =
6
out =
5 6
n =
7
out =
5 6 7
n =
8
out =
5 6 7 8
n =
9
out =
5 6 7 8 9
n =
10
out =
5 6 7 8 9 10
n =
11

4  Pass 
out = [1 3 4 6 8];
vec = [12 10 13 14 9 17 5 18];
thresh = 11;
assert(isequal(findIndices(vec, thresh),out))
x =
1×8 logical array
1 0 1 1 0 1 0 1
out =
[]
n =
1
out =
1
n =
2
n =
3
out =
1 3
n =
4
out =
1 3 4
n =
5
n =
6
out =
1 3 4 6
n =
7
n =
8
out =
1 3 4 6 8
n =
9

5  Pass 
out = [1:3 7:9];
vec = [50 55 60 15 10 5 43 44 97 41];
thresh = 42;
assert(isequal(findIndices(vec, thresh),out))
x =
1×10 logical array
1 1 1 0 0 0 1 1 1 0
out =
[]
n =
1
out =
1
n =
2
out =
1 2
n =
3
out =
1 2 3
n =
4
n =
5
n =
6
n =
7
out =
1 2 3 7
n =
8
out =
1 2 3 7 8
n =
9
out =
1 2 3 7 8 9
n =
10
n =
11

6  Pass 
out = 5:8;
vec = [10 12 14 16 18 20 22 23 7 8 9];
thresh = 17;
assert(isequal(findIndices(vec, thresh),out))
x =
1×11 logical array
0 0 0 0 1 1 1 1 0 0 0
out =
[]
n =
1
n =
2
n =
3
n =
4
n =
5
out =
5
n =
6
out =
5 6
n =
7
out =
5 6 7
n =
8
out =
5 6 7 8
n =
9
n =
10
n =
11
n =
12

7  Pass 
out = [2 4:5 8 12:14 16];
vec = [10 81 24 65 97 13 45 68 24 35 16 79 123 76 45 60];
thresh = 51;
assert(isequal(findIndices(vec, thresh),out))
x =
1×16 logical array
0 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1
out =
[]
n =
1
n =
2
out =
2
n =
3
n =
4
out =
2 4
n =
5
out =
2 4 5
n =
6
n =
7
n =
8
out =
2 4 5 8
n =
9
n =
10
n =
11
n =
12
out =
2 4 5 8 12
n =
13
out =
2 4 5 8 12 13
n =
14
out =
2 4 5 8 12 13 14
n =
15
n =
16
out =
2 4 5 8 12 13 14 16
n =
17

8  Pass 
out = 1:2:9;
vec = [11 9 12 8 13 7 14 6 15 5];
thresh = 10;
assert(isequal(findIndices(vec, thresh),out))
x =
1×10 logical array
1 0 1 0 1 0 1 0 1 0
out =
[]
n =
1
out =
1
n =
2
n =
3
out =
1 3
n =
4
n =
5
out =
1 3 5
n =
6
n =
7
out =
1 3 5 7
n =
8
n =
9
out =
1 3 5 7 9
n =
10
n =
11

482 Solvers
Who knows the last digit of pi?
471 Solvers
Remove the two elements next to NaN value
286 Solvers
1198 Solvers
1078 Solvers