I have recently had to rewrite 90% of our research code (model reduction) which had become too messy and too intricate to support further algorithmic developments and I naturally tried to switch to OO. For this application, performances were really critical.
I have quickly moved away from OO in Matlab and gone back to a more traditional style as the code became horribly slow (even after careful profiling and optimization), apparently due to some overhead in accessing object's methods and properties.
As Matlab has become more efficient in memory management (e.g. function arguments are not duplicated if they are not modified in the function), I prefer to use some structures to organize the data. These structures are passed as arguments to the several functions.
The only one place where I had to use OO was to benefit from the handle class for some data structure which was sometimes modified by some functions and was too big to even consider duplicating it.
In a nutshell: If Matlab had better OO performances, I'd recommend switching to OO, even for critical parts (where speed is critical) of the code. Since this is not the case I prefer to stick to structures sometime with function handle to mimic object methods. The only thing missing is the handle class inheritance.
NB: I do not claim to be an expert in Matlab OO programming, so if some OO guru has hints on how tweak things to speed up OO in order to make it as fast as traditional structures (in terms of accessing, and modifying the object properties + calling methods), I'll take all advices.
Hope this helps.
A.
Best Answer