Example startup.m file: setting Matlab defaults

Maltab / Octave programming forum.

Example startup.m file: setting Matlab defaults

Postby kamil on January 31st, 2008, 7:22 pm

Below is my startup.m file. When Matlab starts it will execute the contents of startup.m script file so long as the script file is placed in Matlab's startup directory or anywhere else in Matlab's path.

Code: Select all
addpath(genpath('inc')); % add any include paths

set(0, 'defaultaxesfontsize', 8);
set(0, 'defaulttextfontsize', 8);
set(0, 'defaultfigurepos', [25 50 1200 600]);
set(0, 'defaultaxeslinewidth', 2);
set(0, 'defaultlinelinewidth', 1);
set(0, 'DefaultAxesLineStyleOrder', {'-','--','-.'});
set(0, 'DefaultAxesColorOrder', [0 0 0; 0.2 0.2 0.2; 0.4 0.4 0.4; 0.6 0.6 0.6]);

format long

The first line can be used to include entire directory trees in Matlab's path. This is usefull if you have a sizable Matlab code base (your own libraries of useful matlab code and / or misc. Matlab toolboxes) and want them to be available at startup. The next few lines configure the default look and feel of Matlab's plots and figures. The last line changes the default display format to long, i.e. echoed numbers will show more than just 4 decimal places.

If you have more useful defaults that can be included in a startup.m then post them in this thread, cheers.
User avatar
kamil
Linux Adept
 
Posts: 114
Joined: January 18th, 2008, 1:22 am
Location: Brisbane, Australia

Return to Maltab

Who is online

Users browsing this forum: No registered users and 0 guests

cron

dsplabs homelinux bloglinux forums new! travel photographyawklores new! cryptographyjames' home
©2008 dsplabs.com.au