User-defined startup script for MATLAB
startup executes user-specified commands when starting MATLAB®. MATLAB executes any file on the search path named
startup that has an
executable file extension. Examples of an executable file extension are
startup.m file in the
userpath folder, which is on the MATLAB search path. Add commands you want executed at startup. For example, your code
might include physical constants, defaults for graphics properties, engineering conversion
factors, or anything else you want predefined in your workspace.
Set Default Colormap
startup.m in your
Set the default colormap to
autumn. Enter this statement into the
set(0, 'DefaultFigureColormap', autumn(64))
Save and close the file.
Restart MATLAB and display a plot.
The default colormap value is
Restore the default colormap value. Remove the
set statement for
Save and close the file. The next time you start MATLAB, the default colormap value is the MATLAB default.
To specify the current folder in MATLAB when it starts, set the Initial working folder preference located in the General Preferences page of the Preferences.
At startup, MATLAB automatically executes the
matlabrc function and, if it
exists on the MATLAB search path,
which is in the
is reserved for use by MathWorks® and by system administrators on multiuser systems.
Introduced before R2006a