Cody

# Problem 14. Find the numeric mean of the prime numbers in a matrix.

Solution 2098442

Submitted on 19 Jan 2020 by zaid aldailami
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   Pass
x = 3; y_correct = 3; assert(isequal(meanOfPrimes(x),y_correct))

dd = 0 s = 1 1 m = 1×9 logical array 0 1 0 0 0 0 0 0 0 dd = 1 a = 3 out = 3

2   Pass
x = [1 2 3]; y_correct = 2.5; assert(isequal(meanOfPrimes(x),y_correct))

dd = 0 s = 1 3 m = 1×9 logical array 0 0 0 0 0 0 0 0 0 m = 1×9 logical array 1 0 0 0 0 0 0 0 0 dd = 1 a = 2 m = 1×9 logical array 0 1 0 0 0 0 0 0 0 dd = 2 a = 2 3 out = 2.5000

3   Pass
x = [3 3; 3 3]; y_correct = 3; assert(isequal(meanOfPrimes(x),y_correct))

dd = 0 s = 2 2 m = 1×9 logical array 0 1 0 0 0 0 0 0 0 dd = 1 a = 3 m = 1×9 logical array 0 1 0 0 0 0 0 0 0 dd = 2 a = 3 3 m = 1×9 logical array 0 1 0 0 0 0 0 0 0 dd = 3 a = 3 3 3 m = 1×9 logical array 0 1 0 0 0 0 0 0 0 dd = 4 a = 3 3 3 3 out = 3

4   Pass
x = [7 3 8 8]'; y_correct = 5; assert(isequal(meanOfPrimes(x),y_correct))

dd = 0 s = 4 1 m = 1×9 logical array 0 0 0 1 0 0 0 0 0 dd = 1 a = 7 m = 1×9 logical array 0 1 0 0 0 0 0 0 0 dd = 2 a = 7 3 m = 1×9 logical array 0 0 0 0 0 0 0 0 0 m = 1×9 logical array 0 0 0 0 0 0 0 0 0 out = 5