I think I got misunderstood by JiHo : I want to avoid the matlab GUI as much as possible. The matlab-console I developed is an implementation of the matlab console IN textmate.
For what I described I use a very similar command as JiHo, except that I tend to use the cell mode (which Thomas added in the last version of the bundle). And in this cases because the commands that are sent to the terminal can be long, I use an temporary m-file (called cellrunner in the following code). I've came up with a better applescript thought, which is more robust when you have several terminal windows or tabs running :
osascript<<END tell application "Terminal" set termwin to id of windows set nwin to count of termwin repeat with i from 1 to nwin set ntab to number of tab of window i repeat with j from 1 to ntab set pr to processes of tab j of window i set npr to count of pr set runsmatlab to false repeat with k from 1 to npr set runsmatlab to "MATLAB" = item k of pr end repeat if runsmatlab then set selected of tab j of window i to true do script with command "cellrunner" in tab j of window i end if end repeat end repeat end tell tell application "MATLAB" to activate END
Pierre