#!/bin/bash
#Author Martin Prudek
#This script decodes datafile codename and print the parameters
# in a matlab-readable way

#check for empty string
if [ ! "$#" -eq 1 ]; then
	echo "Enter file name from '../data/' directory.";
	echo "Turning to default: generating statistics for all the data from '../data/'"
	exit;
fi

filename=`echo "${1}" | sed 's:.*/::'`;
. ./parse_name.sh "${filename}";

if [ -n "${nm[t]}" ]; then echo "t='${nm[t]}';";	fi
if [ -n "${nm[hw]}" ]; then echo "hw='${nm[hw]}';";     fi
if [ -n "${nm[lo]}" ]; then echo "lo='${nm[lo]}';";	fi
if [ -n "${nm[k]}" ]; then echo "k='${nm[k]}';";	fi
if [ -n "${nm[vk]}" ]; then echo "vk='${nm[vk]}';";	fi
if [ -n "${nm[p]}" ]; then echo "p=${nm[p]};";	fi
if [ -n "${nm[ert]}" ]; then echo "ert='${nm[ert]}';";fi
if [ -n "${nm[m]}" ]; then echo "m='${nm[m]}';";	fi
if [ -n "${nm[cn]}" ]; then echo "cn='${nm[cn]}';";	fi
if [ -n "${nm[si]}" ]; then echo "si=${nm[si]};";	fi
if [ -n "${nm[sa]}" ]; then echo "sa=${nm[sa]};";	fi
if [ -n "${nm[n]}" ]; then echo "n='${nm[n]}';";	fi
if [ -n "${nm[bn]}" ]; then echo "bn=${nm[bn]};";	fi

