How to call MATLAB functions from the Linux command line?

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

Leave a Comment

techhipbettruvabetnorabahisbahis forumu