Basically I have an m
file which looks like
function Z=myfunc()
% Do some calculations
dlmwrite('result.out',Z,',');
end
I just want to execute it from the command line without getting into MATLAB. I tried several options (-nodisplay
, -nodesktop
, -nojvm
, -r
, etc.), none of them worked. I end up getting into MATLAB and have to type "quit" to exit.
What is the solution?
MATLAB can run scripts, but not functions from the command line. This is what I do:
File
matlab_batcher.sh
:Call it by entering:
You can call functions like this:
matlab -r "yourFunction(0)"