필터 지우기
필터 지우기

How do I Delete Array Elements

조회 수: 103 (최근 30일)
Rick
Rick 2013년 3월 11일
How do I delete array elements from a list, and then renumber the list in order. This is a 1 dimension array.
For example: If I had an array list of 10 elements: x = [1 2 4 7 8 10 15 18 22 31];
And I want to delete the indexes: 6 7 9 The new list would look like x = [1 2 4 7 8 18 31];
How do I do this ????

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 11일
편집: Azzi Abdelmalek 2013년 3월 11일
x = [1 2 4 7 8 10 15 18 22 31];
x([6 7 9])=[]
  댓글 수: 1
Jan
Jan 2013년 3월 11일
@Rick: This is the most efficient and clean way, and it is explained in the Getting Started chapters of the documentation. It is strongly recommended to read them, because the basics cannot be explained exhaustively in the forum again.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by