필터 지우기
필터 지우기

extract rows of a matrix

조회 수: 1 (최근 30일)
RuiQi
RuiQi 2016년 7월 19일
답변: Star Strider 2016년 7월 19일
I have a matrix with many rows and 6 columns. I want to extract the rows whose 6th column == 1. How can I do this ? And what is this 'technique' called ? Logical indexing ? Find ? I keep forgetting how to do this. I need to refer to the documentation but im not sure what to google.
  댓글 수: 1
Stephen23
Stephen23 2016년 7월 19일
Logical indexing is faster than find.

댓글을 달려면 로그인하십시오.

채택된 답변

Stephen23
Stephen23 2016년 7월 19일
편집: Stephen23 2016년 7월 19일

추가 답변 (1개)

Star Strider
Star Strider 2016년 7월 19일
This works:
M = randi(9, 20, 6);
M_extract = M(M(:,6) ==1, :);

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by