Cody

# Problem 2241. Compare two input matrices

Solution 2819725

Submitted on 11 Aug 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
A=[ 1 2 3 4 5; 5 9 3 0 9] B=[ 1 2 4; 8 9 2] y_correct = 1; assert(isequal(CompareMatrix(A,B),y_correct))

A = 1 2 3 4 5 5 9 3 0 9 B = 1 2 4 8 9 2 x = 2 5 y = 2 3 NoElem_A = 1 NoElem_B = 1 NoElem_A = 1 NoElem_A = 2

Undefined function 'NoElem' for input arguments of type 'double'. Error in CompareMatrix (line 10) NoElem_B=NoElem(B)*i Error in Test1 (line 4) assert(isequal(CompareMatrix(A,B),y_correct))

2   Fail
A=[ 1 2 3 ; 5 9 3 ] B=[ 1 2 4 2; 8 9 2 5] y_correct = 0; assert(isequal(CompareMatrix(A,B),y_correct))

A = 1 2 3 5 9 3 B = 1 2 4 2 8 9 2 5 x = 2 3 y = 2 4 NoElem_A = 1 NoElem_B = 1 NoElem_A = 1 NoElem_A = 2

Undefined function 'NoElem' for input arguments of type 'double'. Error in CompareMatrix (line 10) NoElem_B=NoElem(B)*i Error in Test2 (line 4) assert(isequal(CompareMatrix(A,B),y_correct))

3   Fail
A=magic(10) B=magic(7) y_correct = 1; assert(isequal(CompareMatrix(A,B),y_correct))

A = 92 99 1 8 15 67 74 51 58 40 98 80 7 14 16 73 55 57 64 41 4 81 88 20 22 54 56 63 70 47 85 87 19 21 3 60 62 69 71 28 86 93 25 2 9 61 68 75 52 34 17 24 76 83 90 42 49 26 33 65 23 5 82 89 91 48 30 32 39 66 79 6 13 95 97 29 31 38 45 72 10 12 94 96 78 35 37 44 46 53 11 18 100 77 84 36 43 50 27 59 B = 30 39 48 1 10 19 28 38 47 7 9 18 27 29 46 6 8 17 26 35 37 5 14 16 25 34 36 45 13 15 24 33 42 44 4 21 23 32 41 43 3 12 22 31 40 49 2 11 20 x = 10 10 y = 7 7 NoElem_A = 1 NoElem_B = 1 NoElem_A = 1 NoElem_A = 2

Undefined function 'NoElem' for input arguments of type 'double'. Error in CompareMatrix (line 10) NoElem_B=NoElem(B)*i Error in Test3 (line 4) assert(isequal(CompareMatrix(A,B),y_correct))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!