Closed GoogleCodeExporter closed 8 years ago
Oops, I didn't mean "nan". I meant "inf".
So that would be "inf" or -1 would return the same as "end".
Original comment by rsignell
on 1 Feb 2012 at 7:09
I like the idea of negative indices counting back from the 'end'. Where -1 is
the last element, -2 is the 2nd to last element, etc. Not sure how I feel about
using 'Inf' or 'NaN' though. In my mind, passing in those values should cause
an error.
Original comment by bschlin...@gmail.com
on 1 Feb 2012 at 7:13
Ill take a look at adding this. Probably the -1, etc. style since it would be
familiar to python users anyway.
Original comment by crosb...@gmail.com
on 1 Feb 2012 at 7:32
I like Brian's idea of using -1, -2 to go backward from the end. Let's go with
that!
Original comment by rsignell
on 1 Feb 2012 at 8:04
I like Brian's idea of counting from the end with -1, -2. Let's go with that!
Original comment by rsignell
on 1 Feb 2012 at 8:05
Apparently the indexing function we are using already accepted -1, but had a
different functionality. I've modified it so that all of the below examples
work:
>> g2 = v.grid_interop(1,-1); % last index
>> g2 = v.grid_interop(1,-5); % 4th from the end
>> g2 = v.grid_interop(1,-5:-1); % 4th through last from the end
Original comment by crosb...@gmail.com
on 2 Feb 2012 at 3:50
Original issue reported on code.google.com by
rsignell
on 1 Feb 2012 at 7:08