I am trying to create a MATLAB class with a member variable that's being updated as a result of a method invocation, but when I try to change the property within the class it (apperently, from what I understood from MATLAB's memory management) creates a copy of the object and then modifies it, leaving the original object's property untouched.
classdef testprop
properties
numRequests=0;
end
methods
function Request(this, val)
disp(val);
this.numRequests=this.numRequests+1;
end
end
end
a.Request(9);a.Request(5);
a.numRequests
ans = 0