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

2 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2020 年 8 月 3 日
回答済み: Walter Roberson 2020 年 8 月 3 日
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.

採用された回答

Walter Roberson
Walter Roberson 2020 年 8 月 3 日
A(A(:,1)>A(:,2),:)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by