Matlab Start Up

It is often frustrating, distracting and demotivating when I start Matlab and I have to start a series of commands, most frustrating of all the current directory. In order to automate things a bit the use of startup.m as well as the finish.m comes in handy.

To use this (in Windows there are also similar ways to use in other OS but I haven’t one available right now) one should create a shortcut (e.g. the on in start menu which I prefer as the only thing to start matlab is pressing the windows button and type “mat”) and edit the start in, in the properties menu. The target should be the directory with the startup.m file. In the file one can find:

 
cd c:\...<desired start up path >
...<any other matlab operation>

Any other matlab operation can be another script or matlab code. Typically initialization of parameters that have to do with the workspace mostly, like the plot styles and font sizes. However if you use a script you can run immediately the desired code, although I don’t find any particular reason for someone to be so hasty…

Finish.m works the same way and can be used to store data after finishing a simulation. As far as this is concerned I find it useful sometimes to export data to excel (like mentioned in a previous post) for further manipulation as in the following code example.

save results/testTIMES testTIMES
save results/testSNR testSNR
save results/testBITS testBITS

xlswrite('results',testBITS,1,'B1')
xlswrite('results',testSNR,1,'C1')
xlswrite('results',testTIMES,1,'D1')
Advertisements