WELCOME TO YAROSLAV`S LINUX PAGE
+ -=:Matlab Diaries.(old):=- +
 

I'm doing a lot of research and school work using Matlab, and sometimes I want to see what I've done a week ago on some data - how did I get the results, which data I've read and did I do any mistake on the way?

Matlab has 'diary' command but it sucks... It sucks cause you can't (or at least I didn't find a way) turn it on automatically when you start matlab and what is even more sucky - it doesn't have a timestamp - so how would you distinguish different diaries?

Inspired by my handling of bash_history files I decided to make automatic "diarying" of all my activities, so with each start of matlab, diaries/ subdirectory in pwd contains a file diary.DATETIMESTAMP.matlab.

I accomlished that through a wrapper around matlab which I placed in a directory where I have my 'personal' executables ~/bin

Presented here script also does specification of the path matlab evnironment, which can be also done in simplier way using MATLABPATH environmental variable. So assume that script which is presented here is of old version.

#!/bin/sh
#-------------------------- =+- Shell script -+= --------------------------
# @file      matlab
# @date      Sat Oct 11 21:43:27 2003
# @brief     Wrapper for a matlab call to enable automatic diarying
#
#  Yaroslav Halchenko                                      CS@UNM, CS@NJIT
#  web:     http://www.onerussian.com                      & PSYCH@RUTGERS
#  e-mail:  yoh@onerussian.com                              ICQ#: 60653192
#-----------------\____________________________________/------------------

MATLAB=/opt/matlab/bin/matlab

STARTUPSCRIPT="HOME=getenv('HOME');path(path,[HOME '/rutg/rumba/rumba-matlab/']);"\
"path(path,[HOME '/rutg/ica.scott/']);dddirname='diaries';"\
"status=mkdir(dddirname);"\
"diary([ pwd '/' dddirname '/' strrep(datestr(now),' ','_') '.matlab']);"

$MATLAB $* -r "$STARTUPSCRIPT"

Now just remove $MATLAB/bin from your $PATH and make sure that you start matlab with your new script

which matlab

Then after you start matlab you might find subdirectory diaries... Enjoy.

If you have any comments - I would really appreciate them