Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 416199

Submitted on 10 Mar 2014 by J-G van der Toorn

Correct

15Size
Leading solution size is 15.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
 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
2
Pass
 
%%
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
3
Pass
 
%%
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