Delete values from two column vectors with same position

1 回表示 (過去 30 日間)
Zhou Ci
Zhou Ci 2021 年 10 月 9 日
回答済み: David Hill 2021 年 10 月 9 日
Hello,
I have three column vectors of same sizes. I want to remove values 8, 9, 10 from the one vector (B) such that the subequent values in other two vectors (A and C) also get deleted. Similarly, I want to remove value 10 from vector C such that the subsequent values in other two vectors (A and B) also get deleted (means whole row gets deleted). How to perform this task?
My Data:
Result I want:
A = 7x1 double;
B= 7x1 double;
C= 7x1 double;
I want these three variables separately. Thank you.

採用された回答

David Hill
David Hill 2021 年 10 月 9 日
m=[A,B,C];%need to form matrix
m(ismember(m(:,2),[8 9 10]),:)=[];%entire rows are deleted where 8,9,10 are in column 2 (B)
m(ismember(m(:,3),[10]),:)=[];%enire rows are deleted where 10 is in column 3 (C)

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by