From bug-octave-request at bevo dot che dot wisc dot edu Fri Nov 17 14:26:46 2000 Subject: 'end' keyword From: "John W. Eaton" To: tene at fatkat dot com Cc: bug-octave at bevo dot che dot wisc dot edu Date: Fri, 17 Nov 2000 14:26:35 -0600 On 17-Nov-2000, Eric Tenenbaum wrote: | Although octave does not claim to be 100% compatible with | Matlab M-files I do have a question/request about the 'end' keyword. | Below I show a use of this keyword in both environments. Is it | possible to add the 'end' keyword to make its use compatible with | Matlab? And if you have no plans to do so could you give me a few | pointers into the code where I might try my hand at the task? | | Thanx | ERIC | | tene at fatkat dot com | | | ************************************************************************* | Mahtworks matlab | | >> a=1:5 | | a = | | 1 2 3 4 5 | | >> b=a(3:end) | | b = | | 3 4 5 | ************************************************************************* | | | ************************************************************************* | Octave version GNU Octave, version 2.1.31 (alphaev6-unknown-linux-gnu). | octave:5> a=1:5 | a = | | 1 2 3 4 5 | | octave:6> b=a(3:end) | parse error: | | >>> b=a(3:end) | | ************************************************************************* I have no plans to do this myself. If you want to try, you'll probably have to modify the parse to distinguish this type of end token from the current type of end token, and then build something similar to what is used to handle the colon operator (the one for indexing entire rows or columns, not for building Range objects). Range objects will have to be extended to store this new token too. Then you'll need to modify the idx-vector classes to turn this special token into an actual number. The Array-idx and and Array2-idx classes may have to be changed to pass extra informaion to the idx-vector constructors. Unless you see a better way. jwe ------------------------------------------------------------- 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 -------------------------------------------------------------