title: Call subclass static method from inside superclass static method
body: <p>I have a large set of small, related classes linked together by an interface class. All classes implement a static method, which retrieves and processes data specific to the class. </p>
  
  <p>The output of that static method needs to be formatted in at least 2 ways. Since the transformation of one format to the other is always the same and rather trivial (though long), I thought I'd implement it as a concrete, sealed, static method in the superclass. </p>
  
  <p>However, then I run into the following problem: </p>
  
  <pre><code>% (in Superclass.m)
  classdef SuperClass &lt; handle
  
      methods (Static, Abstract)
          [arg1, arg2] = subsStaticMethod;            
      end
  
      methods (Sealed, Static)
  
          function [other_arg1, other_arg2] = supersStaticMethod
  
              % Get data here
              [arg1, arg2] = (???).subsStaticMethod
  
              % transform data here
              % ...
  
          end
  
      end
  
  end
  
  % (in Subclass.m)
  classdef SubClass &lt; SuperClass 
  
      methods (Static)
  
          function [arg1, arg2] = subsStaticMethod
              % Get class-specific data here
              % ...
          end
  
      end
  
  end
  </code></pre>
  
  <p>As far as I can see, calling <code>SubClass.supersStaticMethod()</code> is impossible with this design, because static methods need to be called using the class name explicitly. In other words, there is no way to insert the subclass name instead of the <code>(???)</code> in <code>SuperClass.supersStaticMethod</code> above.</p>
  
  <p>Things I've tried: </p>
  
  <ul>
  <li><code>mfilename('class')</code> this doesn't work, because this always returns <code>'SuperClass'</code></li>
  <li><code>dbstack</code> does not contain the information that the method is actually being called from a subclass</li>
  </ul>
  
  <p>I know that I can work around this problem by making <code>supersStaticMethod</code> non-static, and calling the method on a temporary instance (like <code>SubClass().supersStaticMethod()</code>). Or create a small wrapper method inside each subclass that just calls the superclass method with <code>mfilename('class')</code> as argument. Or any of a 100 other things that seem equally clumsy.</p>
  
  <p>But I'd really like to know if there is some <code>meta.class</code> trickery or something that can cleanly solve this problem. All I've found is <a href="http://www.mathworks.com/matlabcentral/newsreader/view_thread/247155" rel="nofollow">this dated thread</a>, which processes the MATLAB command line programmatically to get the subclass name. </p>
  
  <p>However, my classes are to be used inside scripts/functions, and command line use is going to be for debugging purposes only...</p>
  
  <p>Any ideas? </p>