フィルターのクリア

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 Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by