[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how do I configure custom subsref() to correctly handle 1:end range
From: |
withaar |
Subject: |
Re: how do I configure custom subsref() to correctly handle 1:end range |
Date: |
Wed, 5 Jun 2013 10:44:22 -0700 (PDT) |
Ok - I am sorry. I just found it in the documentation. For completeness:
You need to write the "end()" method for the class. See manual, section
34.3.1.
The function has to look like this:
function r = end (obj, index_pos, num_indices)
## code
endfunction
obj is the object being indexed
index_pos is a scalar and the dimension of which you have to return the
index to the last element
num_indices is the total number of dimensions of the object
The return value r is the index to the last element in dimension index_pos.
If the size() function has been implemented correctly this function could
look like this:
function r = end (obj, index_pos, num_indices)
r = size(obj,index_pos);
endfunction
W
--
View this message in context:
http://octave.1599824.n4.nabble.com/how-do-I-configure-custom-subsref-to-correctly-handle-1-end-range-tp4653758p4653760.html
Sent from the Octave - General mailing list archive at Nabble.com.