Cody

# Problem 2991. Finding an element in a vector

Solution 1705742

Submitted on 10 Jan 2019
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 7 2 3 2 4 8 6]; y_correct = 3; assert(isequal(first_six(x),y_correct))

z = 3 8

Undefined function or variable 'ind'. Error in first_six (line 4) if isempty(ind)==1 Error in Test1 (line 3) assert(isequal(first_six(x),y_correct))

2   Fail
x = [2 1 4 1 2 10 9 4 12 1 6 5 10 10 3 6 6 8 9 10]; y_correct = 6; assert(isequal(first_six(x),y_correct))

z = 6 7 9 13 14 18 19 20

Undefined function or variable 'ind'. Error in first_six (line 4) if isempty(ind)==1 Error in Test2 (line 3) assert(isequal(first_six(x),y_correct))

3   Fail
x = [4 2 3 4 5 5 3 1 1 2]; y_correct = 'none'; assert(isequal(first_six(x),y_correct))

z = 1×0 empty double row vector

Undefined function or variable 'ind'. Error in first_six (line 4) if isempty(ind)==1 Error in Test3 (line 3) assert(isequal(first_six(x),y_correct))