%% Federico Lombardi
%% Save File with only positive values

clear
%% Import data
filename = 'DFB1_CS2_150K_Tm2';
[t,spc] = eprload(filename);
spc = real(spc);
spc = spc/max(spc);

%% Take positive values
t = t(spc>0);
spc = spc(spc>0);

%% Save on file
A = [t spc];
filename = [filename, '_pos.tsv'];
fileID = fopen(filename,'w');
fprintf(fileID,'%12s\t%24s\n','t','Integrated signal');
fprintf(fileID,'%6s\t%12s\n','ns','arb.un.');
fprintf(fileID,'%24s\t%24s\n','DFB1 CS2', '');
fclose(fileID);
dlmwrite(filename, A,'delimiter','\t','-append');