From bug-request at octave dot org Wed Nov 17 08:22:55 2004 Subject: Re: Indexing 2-D object with N-D array From: David Bateman To: bug at octave dot org Date: Wed, 17 Nov 2004 15:19:25 +0100 Indexing a vector with a N-D object als seems to be wrong. Consider A = [1:10]; idx=[4;9]; A(reshape([idx;idx],[1,length(idx),2])) A(reshape([idx;idx],[length(idx),2])) which under Matlab R12 gives >> A(reshape([idx;idx],[1,length(idx),2])) ans(:,:,1) = 4 9 ans(:,:,2) = 4 9 >> A(reshape([idx;idx],[length(idx),2])) ans = 4 4 9 9 and under octave 2.1.62 gives octave:4> A(reshape([idx;idx],[1,length(idx),2])) ans = 4 9 4 9 octave:5> A(reshape([idx;idx],[length(idx),2])) ans = 4 4 9 9 Funnily that are wrong in differnt ways for N-D indexing. Has this changed in Matlab after R12? Cheers David -- David Bateman David dot Bateman at motorola dot com Motorola CRM +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary ------------------------------------------------------------- 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 -------------------------------------------------------------