Possible Duplicate:
How do properties work in Object Oriented MATLAB?
I have been using MatLab for quite some time but started using OOP just recently.
I have a class that is a simple linked list (it can be anything really). A few methods are declared in the class. Is it possible for the methods to modify the instance from which those are called?
instance.plotData()
cannot modify any properties of the instance .
I have to return the instance for the function to actually have some effect on the instance itself:
instance = instance.plotData();
This seems really cumbersome. Is there a better way of achieving the task?
Addition:
classdef handleTest < handle
properties
number
end
methods
function addNode(this)
a = length(this);
this(a+1) = handleTest;
end
end
end
If i call:
x = handleTest
x.addNode()
then x
has still only one node.