Basically I have an m file which looks like
function Z=myfunc()
% Do some calculations
dlmwrite(\'result.out\',Z,\',\');
end
MATLAB can run scripts, but not functions from the command line. This is what I do:
File matlab_batcher.sh:
#!/bin/sh
matlab_exec=matlab
X="${1}(${2})"
echo ${X} > matlab_command_${2}.m
cat matlab_command_${2}.m
${matlab_exec} -nojvm -nodisplay -nosplash < matlab_command_${2}.m
rm matlab_command_${2}.m
Call it by entering:
./matlab_batcher.sh myfunction myinput