フィルターのクリア

remove specific rows by referencing on the first digit of each row.

1 回表示 (過去 30 日間)
JL
JL 2019 年 9 月 9 日
コメント済み: JL 2019 年 9 月 9 日
Hi everyone, I want to reduce remove rows in matrix A, by referencing on the first number in each row to get B. In this case, if the first number is 1, remove the row
A = [1 1 1 0
0 1 1 1
0 1 1 0
1 0 1 0];
Results B =
B =[0 1 1 1
0 1 1 0];

採用された回答

madhan ravi
madhan ravi 2019 年 9 月 9 日
B = A(~A(:,1),:)

その他の回答 (1 件)

Fabio Freschi
Fabio Freschi 2019 年 9 月 9 日
index = 1;
% A(:,1) == index finds the rows with specific value (logical indexing)
B = A(A(:,1) == index,:)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by