What’s in Your startup.m?
Several of us at The MathWorks were recently discussing how we each use startup.m.
Contents
What is startup.m?
I typically don't use startup.m, but when I do, I have one sitting in a particular directory where there's other code I want to use as well. And I make a MATLAB shortcut in that directory (this is using Windows) that specifies this particular directory as the starting location for MATLAB. When you use this icon for starting MATLAB, it starts in the specified directory, and finds and runs the startup.m located there. I usually do this for presentations that I give, so my startup.m generally includes commands that change default font sizes for figures so the annotations are visible in a large, dimly lit room. I have also helped users customize their own startup.m. Commonly, the contents again includes commands to set up preferences for graphics, for example, to have grid on by default (use something like this: set(0,'defaultAxesXGrid','on'), and similarly for 'YGrid' and 'ZGrid'). I've also seen users randomize the starting point for creating random numbers.
finish.m Anyone?
The analog to startup.m is finish.m. This can be used to save data, ask for confirmation to quit, release a hardware resource, finish writing out a file, etc.
What Do You Use startup.m For?
Do you use startup.m or finish.m? If so, I'd love to hear what you put in these. Post your thoughts here.
- Category:
- Less Used Functionality