Running a matlab script in command line (misleading .m)

The syntax to run a matlab script in batch mode from command line is:

matlab -nodesktop -nosplash -r [command]

Since I’ve accostumed to pass file name as argument to several unix tools I made some confusion on execute a script in matlab. In matlab we should pass a command, not a file name as an argument. So for run a script from command line you should first ensure that your script is in malab path (or is in your current path). Then, remember that to make a call of a Matlab script with several commands without a function you just call it by the script file name (without the .m). So if your script name is foo.m you should call as follow:

matlab -nodesktop -nosplash -r foo

See ya

Changes in the standard Matlab installation

I have to do two changes in the standard Matlab installation:

1. Add a launcher with “-desktop” argument in GNOME menu (which has not been created)

### /usr/share/applications/matlab.desktop ###
[Desktop Entry]
Version=7.8
Name=Matlab
GenericName=Matlab R2009a
Comment=Matlab R2009a: The Language of Technical Computing
Exec=sh /opt/matlab/bin/matlab -desktop
Icon=/home/bob/Pictures/matlab.png
StartupNotify=true
Terminal=false
Type=Application
Categories=Application;Office;

2. Change the matlab preference file permissions:

$ sudo chown -R bob /home/bob/.matlab/

See ya