index of a mnatrix to negative
2 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (2 件)
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
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!