Special selecting rows of a matrix

2 ビュー (過去 30 日間)
mr mo
mr mo 2017 年 12 月 18 日
コメント済み: mr mo 2017 年 12 月 19 日
Hi. I have a matrix of size m*n.
I want to select those rows of this matrix that their value in 10th column are between 10 to 12.
How can I do that?
Thanks a lot.

採用された回答

Roger Stafford
Roger Stafford 2017 年 12 月 18 日
編集済み: Roger Stafford 2017 年 12 月 18 日
Let M be the given matrix. Then do this:
p = (1:size(M,1)).';
p = p(M(:,10)<=12&M(:,10)>=10);
p will be a column vector consisting of the row indices of all rows in M in which the element of the 10th column lies between 10 and 12.
  1 件のコメント
mr mo
mr mo 2017 年 12 月 19 日
Thanks a lot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by