I wish to add a method called nansubset
to the table
class. Essentially it allows you to call T(r,c)
where r
and c
are real positive integer vectors possibly containing NaN
's.
Stubbed code for nansubset.m
could be:
function T = nansubset(T, r, c)
T = T(r,c);
end
I am following the instructions here, which detail how to add a new method to the cell
class. Basically, in a folder on my Matlab path, I create a folder called @table
, and within this folder, create a file called nansubset.m
.
I am getting the following problems:
>> tmpT = table(); nansubset(tmpT, 1, 1)
Undefined function 'nansubset' for input arguments of type 'table'.
and
>> doc @table/nansubset
Your search - @table/nansubset - did not match any documents.
However:
edit nansubset
and
edit @table/nansubset
both open the method file in my editor.
Further, I followed the instructions in the above link to add the plus
method to the cell
class and find that it works perfectly.
Can someone please explain to me how I can add this additional method to the table
class?