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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by