フィルターのクリア

Find rows in matrix A that contain value x, find() fails

2 ビュー (過去 30 日間)
Pseudoscientist
Pseudoscientist 2019 年 4 月 18 日
回答済み: Adam Danz 2019 年 4 月 18 日
I have a 472944 x 5 matrix and I need to locate rows have at least a single occurence of value x=0 in their four first (1:4) elements.
find(A==0); for some reason returns only some of the rows
I have attached the data

採用された回答

Adam Danz
Adam Danz 2019 年 4 月 18 日
This will return a logical vector the same length as the number of rows in your matrix. 'True' values (1) mark rows that have at least one 0-value in the first four columns.
rowIdx = any(A(:,1:4) == 0, 2);
This will return the row numbers
rowNum = find(any(A(:,1:4) == 0, 2));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by