MATLAB: Run function from command line

command linefunctionunix

I want to start a matlab function from the unix command line. For now I use
matlab -nodisplay -r "functionname(argument1, argument2, argumentN);exit"
But for this the function I call needs to be in the folder where I am. Is there a way to call the function like
matlab -nodisplay -r "/path/to/functionname(argument1, argument2, argumentN);exit"
without manually adding it to the search path of matlab?

Best Answer

Do you mean:
matlab -nodisplay -r "cd('/path/to'); functionname(argument1, argument2, argumentN);exit"