#! /usr/bin/python3

import scipy.io as sio
import sys
testa = sio.loadmat('110316_1_ctrl_2.mat')
# print sorted(testa.keys())

fmt = "{:.5f} {:+10.6f}"

for k in range(1,18):
  fname = 'Trace_2_4_{:d}_1'.format(k)
  m = testa.get(fname)
  print fname, m.size
  ff = open('out/' + fname + '.txt', 'w')
  for a in m:
    ff.write(fmt.format(a[0], a[1]))
    ff.write('\n')
  ff.close
print "Done."
