Choose rows that the first column is larger than the second column

4 views (last 30 days)
I have an n*2 matrix A. I only want to have rows that the first column is larger than the second column. What is a simple way to do this?
For example, suppose I have
A = [ 2 1;3 4]
I just want to keep the first row.

Accepted Answer

Walter Roberson
Walter Roberson on 3 Aug 2020
A(A(:,1)>A(:,2),:)

More Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!