Blame view

GUI/SW2/SRC/src/gnuplot.sh 1.87 KB
886c558b   Steve Greedy   SACAMOS Public Re...
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
#!/bin/bash
#***************************************************************************************************
#                                            gnuplot.sh                                            *
#                                           ------------                                           *
# Description : This shell script runs gnuplot using a gspiceui data file as input.                *
# Started     : 2016-04-10                                                                         *
# Last Update : 2016-04-18                                                                         *
# Author      : Mike Waters                                                                        *
# Notes       : An example of the command line generated by this script is :                       *
#                 plot "aem6000-dtk-surge-limit.ngspice.tr" using 1:2 with lines title "V(Lr)", \  *
#                 "aem6000-dtk-surge-limit.ngspice.tr" using 1:3 with lines title "V(Rr)" \        *
#                 | gnuplot -persist                                                               *
#***************************************************************************************************
# THINGS TO DO
#
# (2014-01-22) Implement this function as a gnuplot batch file.
#***************************************************************************************************

FILE="$1"
echo "FILE =" $FILE

HEAD=`head -n 1 $FILE | tr -s ' '`
echo "HEAD =" $HEAD

COLS=`echo $HEAD | wc -w`
echo "COLS =" $COLS

TMP1=`seq 2 $COLS`
echo "TMP1 =" $TMP1

{
  echo -n plot 
  for x in `seq 2 $COLS` ; do
    echo -n \ \"$FILE\" using 1:$x with lines title \"`echo $HEAD | cut -d ' ' -f $x`\"
    if [ ! $x -eq $COLS ] ; then
      echo -n ','
    fi
  done
  echo
#}
} | gnuplot -persist

#***************************************************************************************************