[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: index = 0

From: Francesco Potorti`
Subject: Re: index = 0
Date: Mon, 06 Apr 2009 11:12:21 +0200

>I have an array V(1,N) . I am running some operation where I need to
>declare two boundary conditions at V(0) and V(N+1). 

Octave's arrays are 1-based.  The index always starts at 1 and goes up.
So you cannot access or set the V(0) element, as it does not exist.
Moreover, if your array has length N, you cannot access element V(N+1),
as it does not exist either.

>To do this I declared V= zeros(0,N+1).

If you want a row array (that is, 1 row and N columns) filled with
zeros, you create it with V=zeros(1,N);.

What you did creates an empty array (one with 0 rows).

Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
(entrance 20, 1st floor, room C71)     Web:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]