MATLAB: Executing matlab script from static directory with current path as input in linux (as alias)

linux batchMATLAB

Hello everybody.
I am currently trying to execute a matlab script from a static directory with inputs from dynamic ones as an alias. Basically I manually change the directory to where the files (inputs) are and then execute a matlab script with an alias. This alias should include the current path as well as the execution of the script from a static directory.
My solution so far is:
matlab -nojvm -nodisplay -nosplash -batch path=pwd;run('/pathToScript/script');
When using this solution the "error message" always is zsh:unknown file attribute. Im relatively new to linux.
When using the above solution in two separate steps:
matlab -nojvm -nodisplay -nosplash path=pwd;
%in matlab environment
it works just fine. So basically using the alias to do both executions is just for reducing time.

Best Answer

  • matlab -nojvm -nodisplay -nosplash -batch "path=pwd;run('/pathToScript/script');"
    However I would suggest it would be safer to
    matlab -nojvm -nodisplay -nosplash -batch "addpath(pwd);run('/pathToScript/script');"