From bug-octave-request at bevo dot che dot wisc dot edu Fri Oct 8 12:18:42 1999 Subject: Matlab-like indexing ( var(xx:end) ) From: "John W. Eaton" To: Jean-Marc Valin Cc: bug-octave at bevo dot che dot wisc dot edu Date: Fri, 8 Oct 1999 12:18:43 -0500 (CDT) On 8-Oct-1999, Jean-Marc Valin wrote: | | Is there any plan to allow the use of end (as in Matlab) to | refer to the last element of an array, as in | | var2 = var1(20:end); The following item has been in the PROJECTS file for quite a while: For indexing operations, allow $ to indicate the last element. For example, b = a (3:$, 1:$-1). This means b is a, except for its first 2 rows and last column. Note that $ must be able to appear in arbitrarily complex expressions, so copying the the current implementation of : won't work. Whether the token is `end' or `$' doesn't matter much. To be compatible and use `end' is OK with me. When (or if) this will actually be implemented depends on someone doing the work. I have no immediate plans to do it myself. jwe --------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. To ensure that development continues, see www.che.wisc.edu/octave/giftform.html Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html ---------------------------------------------------------------------