From help-octave-request at bevo dot che dot wisc dot edu Wed May 5 16:04:34 1999 Subject: Re: operation x=x(:) From: Wonkoo Kim To: "John W. Eaton" CC: help-octave at bevo dot che dot wisc dot edu Date: Wed, 05 May 1999 17:04:01 -0400 John W. Eaton wrote: > > On 5-May-1999, oliver dot eichler at gmx dot de wrote: > > | One of the biggest drawbacks to use it is the missing > | 'x=x(:)' operation. > > I'm not sure why you say that it is missing. Octave has understood > colon indexing for a long time. In versions 2.0.12 and later, I > believe that it works in a Matlab-compatible way no matter what the > value of do_fortran_indexing. For earlier versions, you had to set > do_fortran_indexing to 1 (or, for really ancient versions, "yes") to > enable compatible behavior. > > GNU Octave, version 2.0.14 (i686-pc-linux-gnu). > Copyright (C) 1996, 1997, 1998, 1999 John W. Eaton. > This is free software with ABSOLUTELY NO WARRANTY. > For details, type `warranty'. > > octave:1> x = rand (2) > x = > > 0.14962 0.13838 > 0.98633 0.30464 > > octave:2> x = x(:) > x = > > 0.14962 > 0.98633 > 0.13838 > 0.30464 However, x = x(:) does not convert a row vector to a column vector (Octave 2.0.13 for OS/2). Though I don't mind this, but the original poster would, as this is a different behavior from Matlab. //------------------------------------------------------------------- // Wonkoo Kim