% Convert the large text files into individual AOs and store as XML files.
% 
% M Hewitson 18-03-07
% 
% 

clear;

fs = 32.46;

%% Load data

% unfiltered Data
data=load('./Data/2007-02-26_18-37.txt');
x1 = data(:,1);
nsecs = length(x1)/fs;
t  = [linspace(0, nsecs-1/fs, nsecs*fs)].';
out = [t x1];
save 'x1.txt' out -ASCII -DOUBLE -TABS
disp('done x1')

x1 = data(:,2);
nsecs = length(x1)/fs;
t  = [linspace(0, nsecs-1/fs, nsecs*fs)].';
out = [t x1];
save 'x12.txt' out -ASCII -DOUBLE -TABS
disp('done x12')

x1 = data(:,3);
nsecs = length(x1)/fs;
t  = [linspace(0, nsecs-1/fs, nsecs*fs)].';
out = [t x1];
save 'phi1.txt' out -ASCII -DOUBLE -TABS
disp('done phi1')

x1 = data(:,4);
nsecs = length(x1)/fs;
t  = [linspace(0, nsecs-1/fs, nsecs*fs)].';
out = [t x1];
save 'eta1.txt' out -ASCII -DOUBLE -TABS
disp('done eta1')

x1 = data(:,5);
nsecs = length(x1)/fs;
t  = [linspace(0, nsecs-1/fs, nsecs*fs)].';
out = [t x1];
save 'phi12.txt' out -ASCII -DOUBLE -TABS
disp('done phi12')

x1 = data(:,6);
nsecs = length(x1)/fs;
t  = [linspace(0, nsecs-1/fs, nsecs*fs)].';
out = [t x1];
save 'eta12.txt' out -ASCII -DOUBLE -TABS
disp('done eta12')

disp('*** Done.')
clear data;
