#! /bin/csh -f
#==============================================================
#
#  Abs:  execute a Feedback Configuration Matlab application
#
#  Name: FeedbackConfig
#
#  Facility:  SLAC
#
#  Auth: 06-dec-2006 dfairley
#    from 12-Mar-2006, Mike Zelazny (zelazny@stanford.edu):
#
#  executes the Matlab Feedback Configuration application for
#  the feedback indicated by the configuration filename
#
#  input parameter $1 is the configuration filename
#==============================================================
#
# Setup LCLS Environment
#
if (-e ${LCROOT}/tools/script/ENVS.csh) then
#
  source ${LCROOT}/tools/script/ENVS.csh
# {}
#
# {}
#
# Log file on nfs
#
  set user=`whoami`-
  set date=`date`
  set year=`echo $date | cut -d" " -f6`-
  set month=`echo $date | cut -d" " -f2`-
  set day=`echo $date | cut -d" " -f3`-
  set time=`echo $date | cut -d" " -f4 | cut -c1-5`

  if (-e $MATLABDATAFILES/Feedback/log/LNG) then
    set log_file=$MATLABDATAFILES/Feedback/log/$1$user$year$month$day$time.log
  else
    set log_file=$1$user$year$month$day$time.log
  endif
#
# Start the Longitudinal 2x2 Matlab script
#
  matlab -nosplash -nodesktop -r "startLCLS,fbConfig('$1')"
#
else
#
# No afs access
#
  echo Sorry, can't find LCLS environment setup
endif
