%%% Check if the mat file corrsponding to a given data range exists
%%% and has the correct number of files

%dirname='20140202'
%time_start_of_range='00-00-00';
%time_end_of_range='01-00-00';

function status=checkDataRange(dirname,time_start_of_range,time_end_of_range)

MAT_DOES_NOT_EXIST=1;
MAT_IS_NOT_COMPLETE=2;

base_save_file_name= [ dirname '/' 'data_' dirname '_from_' time_start_of_range '_to_' time_end_of_range ];
status=0;

mat_file_name= [ base_save_file_name '_save.mat' ];
    if (exist(mat_file_name)==2)
        disp(['Mat file exists ' mat_file_name ]);
        mat=load(mat_file_name);
    else
        disp(['Mat file does not exist ' mat_file_name ]);
        status=status+MAT_DOES_NOT_EXIST;
    end

    status
    error('stop')
    
    
end %functon