I 've created a Matlab Class, something like that :
classdef myclass
properties x_array = []; end
methods function increment(obj,value) obj.x_array = [obj.x_array ; value); end end end
The problem is, the property "x_array" is never modified when i invoke the increment() function: ex:
s = myclass increment(s,5)
s.x_array ans = []
I did some research, and I reached a conclusion that this is because of Matlab using Lazy Copy for objects, making my class inherit the HANDLE class should have solved this, but it didn't, does anybody know why this is happening ? and if extending the handle class is indeen the solution, isn't this the right way to do it:
classdef myclass < handle
or are there any extra steps ? Thanks in advance