This Julia command works:
run(`/Applications/MATLAB_R2018b.app/bin/matlab -nodisplay -nojvm -r "findalpha('file1'); exit"`)`
However I want to build a general string between the backquote, so that both the Matlab path, and file name file1, can be anything (but will not have special characters).
I know there is a MATLAB package, but I am unsure of its “status” and am trying to minimise number of external packages I use, because this code is being passed on to someone else.
EDIT: Never mind, I found a workaround. If I remove the space before the exit, I do not need the double quotes. So my julia code is:
cmd3 = ["/Applications/MATLAB_R2018b.app/bin/matlab", "-nodisplay", "-nojvm", "-r", "findalpha('file1');exit"]
run(`$cmd3`)
and that executes the shell command
/Applications/MATLAB_R2018b.app/bin/matlab -nodisplay -nojvm -r findalpha('file1');exit