pass variable by reference to function in matlab
classdef myClass < handle properties data end methods function h = myClass(data) h.data = data ; end end end % Then defining a function (which could be a method) like function myFunction(h) h.data = h.data+2; end % lets you do something like h = myClass(0); myFunction(h); h.data ans = 2