% Matlab Script to initialize ICA workspace
% This script is executed by the PLOT_NRM.M script
ilu0='ICALOOKUP0V1.DAT';
ilu1='ICALOOKUP1V1.DAT';
ilu2='ICALOOKUP2V1.DAT';
cnof='PANIC: Can not find/open file: ';
fid=fopen(ilu0,'r');
if fid==-1
    disp([cnof ilu0]);
else
    indata=fscanf(fid,'%s',[9,1]);
    ion_names=fscanf(fid,'%s',[6,1]);
    LookUp0=fscanf(fid,'%*d %d %d %*s %d %d %*s %d %d %*s %d %d %*s %d %d %*s %d %d %*s %d',[13,inf]);
    fclose(fid);
    LookUp0(:,96:-1:1)=LookUp0;
    ix = LookUp0==-1;
    LookUp0(ix) = NaN;
end
fid=fopen(ilu1,'r');
if fid==-1
    disp([cnof ilu1]);
else
    indata=fscanf(fid,'%s',[9,1]);
    ion_names=fscanf(fid,'%s',[6,1]);
    LookUp1=fscanf(fid,'%*d %d %d %*s %d %d %*s %d %d %*s %d %d %*s %d %d %*s %d %d %*s %d',[13,inf]);
    fclose(fid);
    LookUp1(:,96:-1:1)=LookUp1;
    ix = LookUp1==-1;
    LookUp1(ix) = NaN;
end
fid=fopen(ilu2,'r');
if fid==-1
    disp([cnof ilu2]);
else
    indata=fscanf(fid,'%s',[9,1]);
    ion_names=fscanf(fid,'%s',[6,1]);
    LookUp2=fscanf(fid,'%*d %d %d %*s %d %d %*s %d %d %*s %d %d %*s %d %d %*s %d %d %*s %d',[13,inf]);
    fclose(fid);
    LookUp2(:,96:-1:1)=LookUp2;
    ix = LookUp0==-1;
    LookUp2(ix) = NaN;
    LookUp2(find(LookUp2==-1))=find(LookUp2==-1)*NaN;
end
clear ix
load ICAV1.DAT
E=ICAV1(96:-1:1,6);
