以前须要经过shell脚本传参给matlab程序,可是遇到一些问题,现将我遇到的问题分享出来,给遇到一样问题的人一些借鉴。node
shell部分脚本Execl.sh:python
/usr/bin/python /home/shk/IPMProduct.py $1
cd /home/shk/ && /usr/local/MATLAB/R2015b/bin/matlab -nodesktop -nosplash -r "sDate='$1';test;quit"shell
ps:app
1./usr/bin/python /home/shk/IPMProduct.py $1。为调用Python程序,IPMProduct.py为python程序名,$1为shell脚本接收的第一个参数ui
2.cd /home/shk/ && /usr/local/MATLAB/R2015b/bin/matlab -nodesktop -nosplash -r "sDate='$1';test;quit"。为调用matlab程序,test为matlab程序名,sDate='$1'为传入matlab的字符型参数,matlab中用一样的变量sDate接收。quit为执行完test程序后退出matlab环境。-nodesktop -nosplash -r这几个参数见上一篇文档说明。文档
matlab程序部分代码 test.m:直接使用sDate变量便可it