一.需要准备好文件
cp -r ~/Wen/SU2/alpha_0.2/data/0/driver7_PartialNonlocality_L_openMPS_R_complex_20.m ~/Wen/SU2/alpha_0.2/data/${COUNT_job}/driver7_PartialNonlocality_L_openMPS_R_complex_20.m
注意complex文件里面的n=20可以换
二.在matlab里面得到Bell.mat文件
matlab -nojvm -nodesktop
##打开不带图形界面的matlab
driver7_PartialNonlocality_L_openMPS_R_complex_20
##不能加.m
exit
三.实现代码
for(( COUNT_job=0; COUNT_job<=6; COUNT_job++ ))
do
lockfile -1 -r 1 ~/Wen/SU2/alpha_0.2/data/${COUNT_job}.lock
if [ $? == 0 ]; then
cd ~/Wen/SU2/alpha_0.2/data/${COUNT_job}
cp -r ~/Wen/SU2/alpha_0.2/data/0/driver7_PartialNonlocality_L_openMPS_R_complex_20.m ~/Wen/SU2/alpha_0.2/data/${COUNT_job}/driver7_PartialNonlocality_L_openMPS_R_complex_20.m
matlab -nojvm -nodesktop < driver7_PartialNonlocality_L_openMPS_R_complex_20.m
echo "job ${COUNT_job} is over"
fi
done