Linux下的matlab 以及shell脚本调用matlab

本文主要总结一下,在Linux OS 下用shell 脚本调用matlab程序
以及Linux os下shell与matlab中的联系

#!/usr/bin/env sh

rm crossAge/feature/feature.dat
rm crossAge/feature/fea_a.dat
rm crossAge/feature/fea_common_age.dat
rm crossAge/feature/fea_common.dat
rm crossAge/feature/fea_age_b.dat

#if blob name == fea_vis[512,1] ;for face verfication
# adding & for each commond line : parallel extract feature
model=face_iter_11000.caffemodel
TEST=false

if $TEST ;then                  #条件分支          
    build/tools/extract_features_binary crossAge/face_snapshot/$model crossAge/face_train_test.prototxt.test \
    fea_a crossAge/feature/fea_a.dat 401 0 &

    build/tools/extract_features_binary crossAge/face_snapshot/$model crossAge/face_train_test.prototxt.test \
    fea_common_age crossAge/feature/fea_common_age.dat 401 0 &                #这个符号作用是并行执行几个语句
    # && 作用是穿行执行不同的脚本

    build/tools/extract_features_binary crossAge/face_snapshot/$model crossAge/face_train_test.prototxt.test \
    fea_common crossAge/feature/fea_common.dat 401 1 &
    build/tools/extract_features_binary crossAge/face_snapshot/$model crossAge/face_train_test.prototxt.test \
    fea_age_b crossAge/feature/fea_age_b.dat 401 1 

else
    build/tools/extract_features_binary crossAge/face_snapshot/$model crossAge/face_train_test.prototxt.test \
    fea_vis crossAge/feature/feature.dat 401 1

    #change directory and run test accuracy on LFW
    cd ./crossAge
    matlab -nodesktop -nosplash -nojvm -r "fea2mat;quit;"  #调用matlab 同时调用完成自动关闭matlab
    #也就是在调用过程不会有matlab弹窗出现,仅仅是无声的执行
fi

你可能感兴趣的:(shell)