From help-octave-request at bevo dot che dot wisc dot edu Sat Dec 21 09:58:22 2002 Subject: Re: "end" as array index? From: "John W. Eaton" To: ljacques at fyma dot ucl dot ac dot be cc: help-octave mailing list Date: Sat, 21 Dec 2002 09:57:52 -0600 On 22-Dec-2002, Laurent Jacques wrote: | On Friday 20 December 2002 23:12, John W. Eaton wrote: | > On 20-Dec-2002, James Frye wrote: | > | Got what is probably a real dumb newbie question: our lab has a bunch of | > | data analysis scripts written for Matlab. I'm trying to get some of them | > | to work under Octave, even though I know next to nothing about Matlab. | > | The scripts have a mumber of instances of a construct like | > | | > | temp (end-3:end) = 0; | > | > This is equivalent to | > | > temp (length(temp)-3:length(temp)) = 0; | > | > jwe | | Of course but the "end" writing is very useful, specially in | matrices slicing. Yes, but the original question above seemed to be asking "What does this mean and what is some equivalent code that will allow it to work in Octave?" not "Can you implement this in Octave so my code can work?". | Do you thing it's possible to implement that in the octave C++ sources ? | This "end" would refer to the size of the object in the selected dimension. Obviously, I think we know what it is supposed to do. The question is how hard would it be to make it work in Octave? The first few times I thought about this problem, the only solutions I could come up with involved large changes to the code for expressions, ranges, and indexing of matrices. Yesterday I started thinking about how to do it again, and this time I saw a much simpler method, so the changes to do it should be checked in to CVS soon. I'm glad I waited. Implementing the first solutions I came up with a couple of years ago would have been very bad. | Laurent. | P.S. In fact I asked exactly the same question probably 9 months ago. jwe P.S. Octave is free software. Sometimes you have to wait a while until someone gets the urge to implement the features you request. There are some ways to get better or faster service, such as providing funding or adding the features yourself, but complaining about how long it takes to get someone else to do something for you for free is probably not one of them! ------------------------------------------------------------- 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 -------------------------------------------------------------