Cody

Problem 43607. Logical array indexing - part 1

Solution 2002611

Submitted on 4 Nov 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
A = [3 4 5 6 2 4 5 6 3 6]; n = 4; y_correct = [0 0 5 6 0 0 5 6 0 6]; assert(isequal(find_elements(A,n),y_correct))

Assertion failed.

2   Fail
A = [0; 6; 1; 7; 3; 5; 2; 4]; n = 3; y_correct = [0; 6; 0; 7; 0; 5; 0; 4]; assert(isequal(find_elements(A,n),y_correct))

Assertion failed.

3   Fail
A = magic(4); n = 8; y_correct = [16 0 0 13; 0 11 10 0; 9 0 0 12; 0 14 15 0]; assert(isequal(find_elements(A,n),y_correct))

Assertion failed.

Suggested Problems

More from this Author1