overloading - How can I overload find function in Matlab -
can overload find function in matlab?
as know: ind = find(x) locates allnonzero elements of array x, , returns linear indices ofthose elements in vector ind.
but when x array of object, how can use find function findout elements based on these properties ?
as lucius domitius ahenobarbus noted in link gave, there strict rules of when can overload functions in matlab.
take following class:
classdef myclass methods function find(self) fprintf('find(myclass) has been called.\n'); end end end
and execute
x = [myclass myclass myclass] find(x)
this gives following output:
x = 1x3 myclass no properties. methods find(myclass) has been called.
what in overloaded find function you. write function prints out indices of elements match call "these properties", whatever is.
Comments
Post a Comment