[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Smartly accessing the last element of a vector / matrix
From: |
Ploett Norbert |
Subject: |
Smartly accessing the last element of a vector / matrix |
Date: |
Thu, 18 Nov 2004 12:14:46 +0100 |
Hello,
a question just in case I missed something in the manuals:
Is there a more concise notation to access the last element e.g. of a
vector? I am writing things like:
x = rand(1,10);
lastx = x(1,columns(x));
Wouldn't it be snappy to write something Python-like:
lastx = x(1,-1);
and then
butlastx = x(1,-2);
etc.
Anybody have any hints?
Norbert
-------------------------------------------------------------
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
-------------------------------------------------------------
- Smartly accessing the last element of a vector / matrix,
Ploett Norbert <=