Clear Filters
Clear Filters

How to delete an element of a vector?

2 views (last 30 days)
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?

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 16 Mar 2016
Edited: Azzi Abdelmalek on 16 Mar 2016
v=[1 10 3 4 10]  
w=v(v~=10)

%or

v(v==10)=[]

More Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!