Reputation: 5342
I got the answer from the following question. It asks me to create a bash file. The question is in the title
How to call MATLAB functions from the Linux command line?
Thus I tried the following code, as given in the answer.
b_exec=matlab
X="localize(r,q)"
echo ${X} > matlab_command_rq.m
cat matlab_command_rq.m
${matlab_exec} -nojvm -nodisplay -nosplash < matlab_command_rq.m
rm matlab_command_rq.m
The original code in the answer was
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
In the explanation, they mentioned that $1 was function and $2 was inputs. correspondingly, I replaced it with my function 'localize' and inputs (r,q)
But I got the following error
localize(r,q)
./matlab_batcher.sh: 5: ./matlab_batcher.sh: -nojvm: not found
The echo seems to be working. But I really do not know what is happening after that. Could you please help me and tell me the right way to call the matlab function with its arguments???
I called it using the following statement
sh ./matlab_batcher.sh localize r q
Upvotes: 0
Views: 485
Reputation: 4703
You need to change your b_exec
back to matlab_exec
, or you need to change
${matlab_exec} -nojvm ...
to
${b_exec} -nojvm ...
Either way, you need to make it consistent.
Upvotes: 1