clear;

ser = input('Please input series number:  ');
%drc = ['../check_ea/out_', ser, '/'];
drc = ['../../exp_IMAEAfm/check_ea/out_', ser, '/'];
%drc = ['../../exp_ESA_S1fm/check_ea/out_', ser, '/'];
%drc = ['../../exp_ESA_S2fm/check_ea/out_', ser, '/'];
%drc = ['../../exp_IEAfm/check_ea/out_', ser, '/'];

%fnm = dir(drc);
%[num, nn] = size(fnm);

%drcc = ['../check_ea/out_', ser, '/VX000*'];
%drcc = ['../../exp_IMAEAfm/check_ea/out_', ser, '/'];
%drcc = ['../../exp_ESA_S2fm/check_ea/out_', ser, '/VX030*'];
fnm = dir(drc);
[num, nn] = size(fnm)

ofname = ['./charac_', ser, '.txt']
ofile = fopen(ofname, 'w');
for i = 3:2:num-1
    dat_fnm = fnm(i).name;
    lbl_fnm = fnm(i+1).name
i
    [ave_e, gfactor] = plot_ea_sub4(drc, lbl_fnm);
    ave_a = plot_ea_sub5(drc, dat_fnm, lbl_fnm);
    fprintf(ofile, '%s %.2f %.2f %.2f¥n', dat_fnm, gfactor, ave_e, ave_a);
end
fclose(ofile);



