%
%
% Modified for speech and hearing science data collection 11/22/2004
% Updated on 09/26/2006

clear all;
subject = input('Please enter the subject code: ','s');
%conditions = ['B1';'B2';'B3'];
conditions = ['set_1';'set_2';'set_3';'set_4';'set_5';'set_6'; ...
              'set_7';'set_8';'set_9';'set_10'];


%for c = 1:length(conditions)
for c = 1:1
    condition = conditions(c,:);
    disp(sprintf('Detecting and determining the DTMF tones for subject %s and block %s...',subject,condition))
    [y, y_index] = detect_DTMF(subject,condition);
    [recovered_DTMF,recovered_index] = decode_DTMF(y, y_index);       
    verify_DTMF(recovered_DTMF,recovered_index,subject);
    filename = sprintf('../%s/%s_%s.mat',subject,subject,condition);
    save(filename,'recovered_DTMF','recovered_index');
    segment_DTMF(subject,condition,recovered_DTMF,recovered_index);  
    disp(sprintf('Data segmentation of subject %s and block %s is completed...',subject,condition));
end
