Is there a cleaner way to self-reference in Matlab classes?
<p>If we want to call a function that modifies an object's properties, is there another way to self-reference other than using <em>obj.property</em> inside the function?</p>

<p>Example (in other languages such as Java):</p>

<pre><code>public void doSomething(int arg)
    foobar = arg;
end
</code></pre>

<p>However example with Matlab:</p>

<pre><code>classdef Foo &lt; handle
    properties
        foobar = 0;
    end
    methods
        function obj = Foo(arg)
            if nargin &gt; 0 
                obj.foobar = arg;
            end
        end
        function doSomething(obj, arg)
            obj.foobar = obj.foobar + arg; % Needed to reference the current object
        end
    end   
end
</code></pre>

<p>With more properties, it could start to look messy from writing all the "<em>obj.</em>" <br>I've seen some people use "<em>o.</em>" (less characters looks a bit nicer), but I was wondering if there was a better way (ie: without using <em>obj.</em>) or is this the only option?</p>

<p>Thanks!</p>