glu=[datenum(string(readcell('Clarity_Export_GRATA_PAMELA_2023-12-05_015102.csv',...
    'Range','B2525:B2575'))),readmatrix('Clarity_Export_GRATA_PAMELA_2023-12-05_015102.csv','Range','H2525:H2575')];
fs=[datenum([2023 12 03 19 42 00;...
    2023 12 03 20 17 00;...
    2023 12 03 20 40 00;...
    2023 12 03 21 17 00;...
    2023 12 03 21 58 00]),...
    [119;117;117;159;179]];

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)-10/24/60;fs(:,1)],[glu(:,2);fs(:,2)],ones(56,1)*1e9,glufit(:,1));
plot(glu(:,1)-10/24/60,glu(:,2),'o:',fs(:,1),fs(:,2),'o:',glufit(:,1),glufit(:,2));grid;shg

save glu glu fs filets spects glufit
