I hate these shiny undocumented features
      30 septembre 2014
      Did you know Matlab read and execute the startup.m file located in your 
MATLAB_HOME directory ? 
Yes of course. 
But you didn't know he was executing
it when you try to compile from outside a matlab environement 
(= from OS command line) !
Of course, the only doc you (I) can find about it is lost somewhere in the mess of the forums.
P.S. Don't say it's linked to closed source apps, I know some free/open/not-closed source apps having this same behaviour...