%do_kalman
clear variables

%subdirectory where amps are stored, and where the calculated positions
%will be stored.
%Initial setting will normally be 'ampsfilt', but will need changing after
%any amplitude adjustments
basepath='ampsfilt';

%kalmansuffix is added to 'kalman' to form the name of the new subdirectory in
%basepath where the position data will be stored.
%Use this variable to distinguish different versions of the position data,
%e.g those calculated with vs. without start positions
kalmansuffix='??';

%just for reference, include a comment line here with the names of the
%sensors

%Normal list of channels to process is 1:12, but eliminate any channels
%from the list that are not in use (or unusable)
chanlist=[1:12];

%Leave startfile empty to run without start positions. Otherwise insert the
%name of the mat file containing the start positions to use
startfile='';
%set up for variables names used by showstats, mode 7
	if ~isempty(startfile)
	startpos=mymatin(startfile,'data');
	startcomment=mymatin(startfile,'comment');
	disp('Comment with start positions');
	disp(startcomment);
end;

triallist=[??];	%list of trials to process

if exist('startpos','var')
	outstats=kalman_fb(basepath,kalmansuffix,triallist,chanlist,startpos);
else
	outstats=kalman_fb(basepath,kalmansuffix,triallist,chanlist);
end;

%This stores a small mat file with a few statistics on the quality of the
%Kalman solution. Currently for maintenance purposes only
%Uncomment if required
%save(['kalmanstats_' basepath kalmansuffix '_' int2str(triallist(1)) '_' int2str(triallist(end))],'outstats');

