필터 지우기
필터 지우기

How to delete an element of a vector?

조회 수: 7 (최근 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 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