Compare two input matrices - MATLAB Cody - MATLAB Central

Problem 2241. Compare two input matrices

Difficulty:Rate
Check which input matrix has more elements. Return "1" if matrix A has more elements than matrix B. Otherwise return "0".
Example
A = [ 1 2 3 4 5; 5 9 3 0 9 ]
B = [ 1 2 4; 8 9 2 ]
CompareMatrix(A,B)
ans=1
Matrix A has 10 elements. Matrix B has 6. Ans=1.

Solution Stats

74.81% Correct | 25.19% Incorrect
Last Solution submitted on Jun 10, 2025

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
2
3

Problem Recent Solvers356

Suggested Problems

More from this Author2

Community Treasure Hunt

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

Start Hunting!