필터 지우기
필터 지우기

index of a mnatrix to negative

조회 수: 1 (최근 30일)
Kaushik
Kaushik 2012년 12월 4일
hi,
i have a matrix a =1:10;
so a(1) = 1 and and a(10)=10
is it possible to start indexing from say -3.
so a(-3) = 1, a(-2)=2....a(0)=4,..., and a(6)=10

답변 (2개)

Matt Fig
Matt Fig 2012년 12월 4일
No. MATLAB has the first index as 1.

Azzi Abdelmalek
Azzi Abdelmalek 2012년 12월 4일
편집: Azzi Abdelmalek 2012년 12월 4일
You can use positive index to represent negative index.
for example if you have to compute y(k)=sin(k) for k=-3:10
for k=-3:10
idx=k+4; % to make index positive
y(idx)=sin(k)
end

카테고리

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