Take the tour ×  I used MATLAB to write a simulation engine for
the simulation of product flows in a production environment. I
inherited all used class from handle and used these handles
(quite excessively, I guess) to link between e.g. products and
work systems, orders, etc.  Now, to run multiple instances of my
model, I create a simulation object that contains all other
objects and their relations, run the model and free the
simulation variable.  Creating and running the model takes ~50
seconds (this including the generation of all objects, their
relations and of course the calculation over the course of the
simulation run). Freeing the variable before the next run,
currently takes ~3-4 minutes!  I tried clear, delete and plain
overwriting of the old simulation object, without notifying
significant differences in performance.  Is there a way to
improve the performance without rewriting the code?
share|improve this question that sounds quite unusual, how many
objects are you creating? Also have you tried 'c