From help-request at octave dot org Sun Feb 13 12:24:48 2005 Subject: RE: Select elements according to the index From: "Chen, Minyu" To: "Chen, Minyu" , Date: Sun, 13 Feb 2005 18:29:10 -0000 This is only a problem with Octave 2.1.40. As I upgraded to Octave 2.1.64, it doesn't present any problem. So people with 2.1.64 need not be disturbed by my post. Thanks, Minyu Chen -----Original Message----- From: Chen, Minyu [mailto:mchenl at essex dot ac dot uk]=20 Sent: 13 February 2005 13:32 To: help at octave dot org Subject: Select elements according to the index Hi: Sorry if my question seems too simple. Suppose I have an index matrix of 2 by 3, e.g. a=3D[1 2 3; 4 5 6] And have a vector of 1 by 8, e.g. b=3D[.1 .2 .3 .4 .5 .6 .7 .8] And I want to create a matrix c of 2 by 3 (the same dimension of a), with c(i,j)=3Db(a(i,j)), that's being said: c=3D[.1 .2 .3; .4 .5 .6] In matlab, as memory serves correctly, I can do it by typing: c=3Db(a) but this command in Octave will generate only a vector of 1 by 6: c=3D[.1 .4 .2 .5 .3 .6] How can I get the matrix I want? Many Thanks, Minyu Chen ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html ------------------------------------------------------------- ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------