#!/bin/bash #$ -S /bin/bash function Usage(){ cat << USAGE Usage: `basename $0` --indir in_dir --max_node segments_total --tdf TDF --postfix PF <other options> Compulsory arguments: --indir Output of Step 2 --max_node The total number of nodes/segments --tdf TDF MATLAB files --postfix The name of Quadratic programming solver that used in step 2 postfix = {qpip / quadprog} USAGE exit 1 } if [[ $# -eq 0 ]]; then Usage >&2 fi while [[ $# -gt 0 ]] do key="$1" case $key in --help) Usage >&2 exit 0 ;; --indir) input_dir=${2} shift shift ;; --max_node) segments_total=${2} shift shift ;; --tdf) TDF=${2} shift shift ;; --postfix) PF=${2} shift shift ;; *) # unknown option Usage >&2 ;; esac done # Run the MATLAB script matlabcall="addpath(genpath('${TDF}')); Step3('${input_dir}', '${segments_total}', '0.05' ,'_100_${PF}')" matlab -nodisplay -nosplash -singleCompThread -r "${matlabcall};exit;"