glu=[datenum(string(readcell('Clarity_Export_GRATA_PAMELA_2023-12-17_191132',...
    'Range','B3375:B3449'))),readmatrix('Clarity_Export_GRATA_PAMELA_2023-12-17_191132','Range','H3375:H3449')];
fs=[datenum([2023 12 16 10 26 00;...
    2023 12 16 10 50 00;...
    2023 12 16 11 11 00;...
    2023 12 16 11 32 00;...
    2023 12 16 11 54 00;...
    2023 12 16 12 16 00;...
    2023 12 16 12 37 00;...
    2023 12 16 12 59 00;...
    2023 12 16 13 20 00;...
    2023 12 16 13 40 00;...
    2023 12 16 14 03 00;...
    2023 12 16 14 26 00;...
    2023 12 16 14 48 00;...
    2023 12 16 15 12 00;...
    2023 12 16 15 31 00;...
    2023 12 16 15 52 00;...
    2023 12 16 16 14 00]),...
    [123;120;106;139;192;206;219;321;292;286;264;287;245;220;195;168;120]];

tnom=-30+10.24/2:.0025:-10.24/2;
p=dir('pam*');

for i=1:length(p)
    filets(i)=datenum(str2num(p(i).name(5:8)),...
        str2num(p(i).name(10:11)),...
        str2num(p(i).name(13:14)),...
        str2num(p(i).name(16:17)),...
        str2num(p(i).name(19:20)),...
        str2num(p(i).name(22:23)));
    spects(i,:)=filets(i)+tnom/24/3600;
end

t=spects';
glufit=t(:);
glufit(:,2)=splinapp([glu(:,1)-0/24/60;fs(:,1)],[glu(:,2);fs(:,2)],ones(93,1)*5e6,glufit(:,1));
p2p=max(glufit(:,2))-min(glufit(:,2));
plot(glu(:,1)-0/24/60,glu(:,2),'o:',fs(:,1),fs(:,2),'o:',glufit(:,1),(glufit(:,2)-p2p)*1.1+p2p);grid;shg

save glu glu fs filets spects glufit
