Borrar filtros
Borrar filtros

How to delete an element of a vector?

2 visualizaciones (últimos 30 días)
Andre Ged
Andre Ged el 16 de Mzo. de 2016
Comentada: Consensor el 24 de Oct. de 2023
Given a vector v, containing elements from 1 to 10, I have to delete the elements of that vector that are equal to 10. For example
v=[1 10 3 4 10]
I have to obtain
v*=[1 3 4]
How can I do this?

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 16 de Mzo. de 2016
Editada: Azzi Abdelmalek el 16 de Mzo. de 2016
v=[1 10 3 4 10]  
w=v(v~=10)

%or

v(v==10)=[]
  1 comentario
Consensor
Consensor el 24 de Oct. de 2023
this is actually so simple i could cry.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by