r_data_pos_all.m 2.8 KB
function r_data_pos_all(nbF)
% R_DATA_POS_ALL - Runs R_DATA_POS in batch mode and saves summary data.
%
% Syntax:  r_data_pos_all(nbF)
%
% Inputs: 
%     nbF          - The number of floes (40 or 80)
%
% Example:
%    r_data_pos_al(80)
%
% Other m-files required: R_CREATE_FLOE, R_FILL_DATE, R_CHOOSE_HT
%                         Image Processus Toolbox
% Subfunctions: none
% MAT-files required: data_$expNumber_$camNumber.mat (produced by R_RECON)
%                     list1.mat 
%
% See also: R_RECON, R_LIST, R_FIGS_POS, R_FIGS_SUMMARY_POS
%
% Author: Marie-Pier Marquis, Dany Dumont
% UQAR/ISMER
% email: dany_dumont@uqar.ca
% Website: http://www.ismer.ca/dumont-dany
% July 2014, Last revision: January 2014
% ________________________________________________________________________
%% Don't forget to change parameters into r_data_pos

nbFStr  = num2str(nbF);
if nbF == 80
    e1 = 201307241037; % same experiment as 201307241018
    e2 = 201307241056; % same experiment as 201307241018
elseif nbF == 40
    e1 = 201307251513; % same experiment as 201307251413
    e2 = 201307251532; % same experiment as 201307251413
end


%% Open files
rootdir   = r_root(nbF);
listfile2 = [rootdir,'/info.mat'];
listfile  = [rootdir,'/list1.mat'];
load(listfile) 
load(listfile2)

fps       = info.fps;
ave       = info.average;
type      = info.waveType;
data      = info.data;
sumRes    = info.sumResult;
figsSum   = info.figsSummary;
fpsStr    = num2str(fps);
aveStr    = num2str(ave);
sumdir    = [rootdir,'/',fpsStr,'fps_',nbFStr,'f_',aveStr,sumRes];  

if ~exist(sumdir,'dir')
    mkdir(sumdir)
end

%% Initialization
StdHs = nan.*ones(6,10,16);
dyHs  = nan.*ones(6,10,16);

%% Different data, experiment by experiment.
for i = 1 : length(list1.exp) 
    if list1.nf(i)==nbF && list1.wt(i)==type && list1.exp(i)~=e1 &&...
            list1.exp(i)~=e2
        
        expNumber  = list1.exp(i);
        disp(num2str(expNumber))
        exp        = num2str(expNumber);
        tp         = list1.tp(i);
        hs         = list1.hs(i);
        
        rowCounter = 0;           % Count the number of rows        
        for ca = 1:4
            cam    = num2str(ca);
            for r = 1:4
                rowCounter = rowCounter + 1;
                row        = num2str(r);
                expdir     = [rootdir,'/',exp,'_multicam'];
                datafile   = [expdir,'/',data,exp,'_',cam,'_',row,'.mat'];
                cd(expdir)
                if(exist(datafile,'file'))
                    [StdHs, dyHs] = r_data_pos(expNumber,ca,r,nbF,StdHs,...
                                         dyHs,hs,tp,rowCounter);                    
                end
            end 
        end       
    end    
end

%% Saving summary data
disp(' Saving summary data ... ');
save([sumdir,figsSum,fpsStr,'fps_',nbFStr,'f_',aveStr],'StdHs','dyHs','-v7.3');  
 
end