index = 0

Francesco Potorti` Potorti at isti.cnr.it
Mon Apr 6 04:12:21 CDT 2009


>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: Potorti at isti.cnr.it
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/


More information about the Help-octave mailing list