0

I have a class that its properties are often accessed by several nested indices, it works fine, but the code is ugly and unreadable:

self.beta(self.index(self.act))=self.beta(self.index(self.act))+self.alpha*self.step(self.index(self.sv));

Is there any command like "with" in python or "using" in other languages to avoid ".self"s? Thanks

Arya
  • 145
  • 6

1 Answers1

0

You can try to use modules for something equivalent:

http://www.mathworks.com/matlabcentral/fileexchange/38014-module-encapsulate-matlab-package-into-a-name-space-module

This doesn't seem like a very practical solution to me, but I suppose if the above statement is really making your eyes bleed, you might consider going that way.

You'll find this link particularly helpful in determining what MATLAB can and can't do in terms of OOP:

http://www.mathworks.com/help/matlab/matlab_oop/matlab-vs-other-oo-languages.html

Remember to never try to code languages as if they are other languages :)

Illumin8s
  • 121
  • 1
  • 8