How to delete an element of a vector?

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

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2016-3-16
编辑:Azzi Abdelmalek 2016-3-16
v=[1 10 3 4 10]  
w=v(v~=10)

%or

v(v==10)=[]

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by