title: Best alternative to MATLAB's global variables
body: <p>I'm writing a <a href="http://en.wikipedia.org/wiki/MATLAB" rel="nofollow">MATLAB</a> application which has many functions spread over different files. I have a logger, which is a struct with a function pointer, and I use it to log information for the user to see (that is, which function is currently executing, calculation results, etc.). The reason I use a struct for my logger and not simply <code>fprintf()</code> is that I could easily replace it with an XML logger, HTML logger, etc. in the future.</p>
  
  <p>Since my code is composed of many functions calling each other, I declared my logger struct as global, so I don't have to pass it to all my many functions. However, everywhere I look I see that global variables are evil incarnate in MATLAB and will slow my program down considerably.</p>
  
  <p>Is there a way to have variables available across files without necessarily passing them as input parameters, and without suffering from severe performance penalty?</p>