how to delete value from one vector such that the subsequent value in other two vectors also gets deleted?

3 次查看(过去 30 天)
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 values 8 9 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?

回答(1 个)

Walter Roberson
Walter Roberson 2021-10-8
mask = ismember(YourArray(:,2), [8 9 10]) | ismember(YourArray(:,3), [8 9 10]);
NewArray = YourArray(~mask, :);
  1 个评论
Zhou Ci
Zhou Ci 2021-10-8
These A,B,C are three different variables in my MATLAB workspace. And rather than using mask (means using the first line of code and getting logical), I want these three separately. Becuase for my further work I'm using them separately. Result should be like:

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Author Block Masks 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by