extract rows of a matrix

1 次查看(过去 30 天)
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.

采纳的回答

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