Find common elements in matrix rows - MATLAB Cody - MATLAB Central

Problem 67. Find common elements in matrix rows

Difficulty:Rate
Given a matrix, find all elements that exist in every row.
For example, given
A =
1 2 3 5
9 2 5 9
3 2 5 9
1 2 1 5
5 1 3 2
the answer would be the vector '2 5'. Elements should be returned sorted ascending.
Note there is no guarantee that there are any such elements; if there are none, the routine should return the empty set. Also, the matrix might contain NaNs, repeats, or very large or very small elements.

Solution Stats

36.03% Correct | 63.97% Incorrect
Last Solution submitted on May 06, 2025

Problem Comments

Solution Comments

Show comments
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
3

Problem Recent Solvers2679

Suggested Problems

More from this Author96

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page