matrix starting index from zero

17 次查看(过去 30 天)
mahsa
mahsa 2014-8-4
评论: Rik 2021-4-3
hello everybody how we can change matrix first index? i mean that start from zero instead of one. for example
a=[60,78;100,400;200,600]
a(0,0)=60
a(1,0)=100
  1 个评论
Sagar Damle
Sagar Damle 2014-8-4
But why do you want the index to start from zero ? In MATLAB,it starts from one and this does not pose any problem !!

请先登录,再进行评论。

回答(2 个)

Roger Wohlwend
Roger Wohlwend 2014-8-4
You cannot do that. The first element is a(1,1) and there's no way to change that.

Azzi Abdelmalek
Azzi Abdelmalek 2014-8-4
编辑:Azzi Abdelmalek 2014-8-4
Subscript indices must either be real positive integers or logicals
you can work with your indices by adding 1 to them
a(0+1,0+1)
a(1+1,0+1)
  3 个评论
Rik
Rik 2021-4-3
It is unlikely mahsa is still monitoring this thread. Why don't you explain why you want this?

请先登录,再进行评论。

类别

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