remove index

조회 수: 21 (최근 30일)
huda nawaf
huda nawaf 2012년 4월 28일
hi,
how I can remove index 3,6,9,....?
ex.
x=[10 2 3 5 15 7 8 100 2 10 12 23 20];
i need x be
x=[10 2 5 15 8 100 10 12 20];
I do not want use loop
thanks in advance

채택된 답변

Wayne King
Wayne King 2012년 4월 28일
x = [10 2 3 5 15 7 8 100 2 10 12 23 20];
x(3:3:end) = [];
  댓글 수: 1
Andrei Bobrov
Andrei Bobrov 2012년 4월 28일
x(nonzeros((1:numel(x)).*(rem(1:numel(x),3)~=0)))

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by