-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdserver.sh
More file actions
53 lines (42 loc) · 1.24 KB
/
dserver.sh
File metadata and controls
53 lines (42 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#
# Launches predefined matlab script that loads and processes predefined matlab data
# Clears all the previous temporal data
# Launches predefined matlab script in silent mode
# Generates output data
# 2015 Victoria Rudakova, vicrucann@gmail.com
#{{{# ARGUMENT PARSING
# ================
args=("$@")
nargs=$#
if [ $nargs -ne 4 ]; then
printf "ERROR: Number of passed parameters must be equal 4\n"
exit 1
fi
REMMAT=${args[0]}
IFILE=${args[1]}
RESFILE="result_$IFILE"
CACHE=${args[2]}
NCACHE=${args[3]}
test -e $REMMAT.m # check file exists
if [ $? -ne 0 ]; then
printf "Error on remote: no such file - %s\n" $REMMAT.m
exit 1
fi
test -e $IFILE # check file exists
if [ $? -ne 0 ]; then
printf "Error on remote: no such file - %s\n" $IFILE
exit 1
fi
printf "\nRemote matlab script name: %s\n" $REMMAT
printf "Input file name: %s\n" $IFILE
printf "Result save name: %s\n\n" $RESFILE #}}}
#{{{# LAUNCH THE MATLAB FUNCTION
# ================
printf "\nRunning matlab script\n"
matlab -nodisplay -nojvm -nosplash -nodesktop -wait -r "$REMMAT('$IFILE','$RESFILE','$CACHE','$NCACHE');quit();"
printf "\nMatlab work done\n" #}}}
#{{{# INDICATE MATLAB HAD FINISHED CALCULATIONS
# ================
> dserver.dn
printf "\nresult.dn file generated\n" #}}}