How to delete an element of a vector?

5 ビュー (過去 30 日間)
Andre Ged
Andre Ged 2016 年 3 月 16 日
コメント済み: Consensor 2023 年 10 月 24 日
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)=[]
  1 件のコメント
Consensor
Consensor 2023 年 10 月 24 日
this is actually so simple i could cry.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeoscience についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by