clear;
%ser = input('Please input series number:  ');
%fname = ['../cal/', ser, '.txt'];

%MDPtestSYS@ISAS
%fname = '../../view_mdp/dat/130206.lm';
%fname = '../../view_mdp/dat/130411.lm';
%fname = '../../view_mdp/dat/130411_15.lm';
%fname = '../../view_mdp/dat/130411_16.lm';
%fname = '../../view_mdp/dat/130411_17.lm';
%fname = '../../view_mdp/dat/130415_15.lm';

%2nd Integration test
%fname = '../../mmo130212/dat/MSA.lm';
%fname = '../../mmo130308/dat/MSA_09.lm';
%fname = '../../mmo130308/dat/MSA_16.lm';
%fname = '../../mmo130309/dat/MSA_09.lm';
%fname = '../../mmo130309/dat/MSA_12.lm';
%fname = '../../mmo130311/dat/MSA_09.lm';
%fname = '../../mmo130311/dat/MSA_17.lm';

%SIf 5/14
%fname = '../../mmo130514/dat/MSA.lm';
%fname = '../../mmo130515/dat/MSA.lm';
%fname = '../../mmo130516/dat/MSA.lm';

%Function-D 5/30
%fname = '../../mmo130530/dat/MSA.lm';

%Function-S 6/19
%fname = '../../mmo130619/dat/MSA.lm';

%Obs-smu 9/12-13
%fname = '../../mmo130912/dat/MSA.lm';
%Function-D 10/16-17S
%fname = '../../mmo131016/dat/MSA.lm'
%fname = '../../mmo131017/dat/MSA.lm'
%Func-s 12/03
%fname = '../../mmo131203/dat/MSA.lm'
%Func-s 12/09
%fname = '../../mmo131209/dat/MSA.lm'
%Func-s 12/20
%fname = '../../mmo131220/dat/MSA.lm'
%Func-s 1/6 2014
%fname = '../../mmo140106/dat/MSA.lm'
%Func-s 1/10 2014
%fname = '../../mmo140110/dat/MSA.lm'
%fname = '../../mmo140123/dat/MSA.lm'




dat= dlmread(fname, ' ');
n = size(dat);
i = 1;
k = 1;
for i = 1:n(1)
    %MDPの時刻
    if dat(i, 2) == 9 & dat(i, 3) == 9 & dat(i,4) == 9 & dat(i,5) == 9
        ti = dat(i,1);
    else
        dat1(k, 1) = ti;
        dat1(k, 2) = dat(i,1);
        dat1(k, 3) = dat(i,2);
        dat1(k, 4) = dat(i,3);
        dat1(k, 5) = dat(i,4);
        dat1(k, 6) = dat(i,5);
        k = k + 1;
    end
end

fn = 3;
figure(fn);
%subplot(2,1,1);
plot(dat1(:,1)*16, dat1(:,2), 'rs','MarkerSize',4);
grid on;
%title('g-factor');
xlabel('MDPtime');
ylabel('MSAtime');
hold on
%plot([0 1e6], [0 1e6], '--');
sec = 0.
for i = 1:k-1
    if dat1(i, 3) == 0
        plot(dat1(i,1)*16, dat1(i,2), 'bs','MarkerSize',4);
    elseif dat1(i, 3) == 16
        plot(dat1(i,1)*16, dat1(i,2)+100000, 'gs','MarkerSize',4);
    end
end
hold off

figure(fn+1);
%subplot(2,1,2);
plot(dat1(:,1)*16, dat1(:,4), 'rs','MarkerSize',4);
grid on;
%title('g-factor');
xlabel('MDPtime');
ylabel('MSAtime');
hold on

sec = 0.
for i = 1:k-1
    if dat1(i, 3) == 0
        plot(dat1(i,1)*16, dat1(i,4), 'bs','MarkerSize',4);
    elseif dat1(i, 3) == 16
        plot(dat1(i,1)*16, dat1(i,4), 'gs','MarkerSize',4);
    end
end
hold off


