How to delete the same element in matrix?

1 visualización (últimos 30 días)
win
win el 15 de Mayo de 2013
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.

Respuesta aceptada

Jan
Jan el 15 de Mayo de 2013
Editada: Jan el 15 de Mayo de 2013
A(A==B) = [];
or
A = A(A ~= B);
  2 comentarios
win
win el 15 de Mayo de 2013
thank youuuuuuuuuu
Jan
Jan el 15 de Mayo de 2013
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by