Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
zero based array indexing

Subject: zero based array indexing

From: dodo_2k@my-deja.com

Date: 16 Jul, 1999 20:25:49

Message: 1 of 3

Hi

I am working with orthogonal polynomials and would like to use zero
based indexing of arrays, e.g. as is standard in C, and as is allowed
in fortran a(0:m)


Can Matlab do this?

Thanks







Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Subject: zero based array indexing

From: Abraham-Magid Shaishaa

Date: 16 Jul, 1999 17:05:48

Message: 2 of 3



dodo_2k@my-deja.com wrote:

> Hi
>
> I am working with orthogonal polynomials and would like to use zero
> based indexing of arrays, e.g. as is standard in C, and as is allowed
> in fortran a(0:m)
>
> Can Matlab do this?
>
> Thanks
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

MATLAB does not allow an index of zero into an array. All indexing
starts at 1.

Sincerely,

Abraham-Magid Shaishaa

Subject: zero based array indexing

From: Rich Pawlowicz

Date: 16 Jul, 1999 21:24:51

Message: 3 of 3

Abraham-Magid Shaishaa wrote:
>
> dodo_2k@my-deja.com wrote:
>
> > Hi
> >
> > I am working with orthogonal polynomials and would like to use zero
> > based indexing of arrays, e.g. as is standard in C, and as is allowed
> > in fortran a(0:m)
> >
> > Can Matlab do this?
> >
> > Thanks
> >
> > Sent via Deja.com http://www.deja.com/
> > Share what you know. Learn what you don't.
>
> MATLAB does not allow an index of zero into an array. All indexing
> starts at 1.


Actually, Matlab *can* use zero-based indices. They are indicated with
an (unfortunately rather low precedence and rather obscurely
documented) prefix operator "1+", i.e.

a(1+(0:m))


(Steve Eddins actually pointed this out a while back)

Rich.

--
Remove XYZ from email address.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us