How to delete the same element in matrix?

1 次查看(过去 30 天)
i have a matrix
if true
B = input('enter the element to delete(enter any one 1,2,5,8,6,)= ')
A = [1 2 5 8 6];
end
When i enter any one of the number in the input, then delete that element in the matrix. how can i do please help.

采纳的回答

Jan
Jan 2013-5-15
编辑:Jan 2013-5-15
A(A==B) = [];
or
A = A(A ~= B);
  2 个评论
Jan
Jan 2013-5-15
You are welcome. You have seen, that this answer took 3 hours. But such fundamental methods are explainbed exhaustively in the Getting Started chapters of the documentation. I suggest to read them, because you will get the wanted answers much faster then.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by