%
disp(' ');
disp(' uci.m  ver 1.0  March 20, 2009 ');
disp(' by Tom Irvine   Email: tomirvine@aol.com');
disp(' ');
disp(' This script removes header lines from ');
disp(' an external ASCII text file. ');
disp(' It also divides a multi-channel file');
disp(' into separate channels. ');
disp(' ');
%
clear mdata;
j=1;
%
[filename, pathname] = uigetfile('*.*');
filename = fullfile(pathname, filename); 
fid = fopen(filename,'r');
%
for(i=1:10000000)
%
            clear THF;
            THF = fgets(fid);
            if(THF==-1)
                if(max(size(THF))==1)
                    break;
                end
            end
            iflag=0;
            k = findstr(THF,'a');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'b');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'c');
            if(k>=1)
                iflag=1;
            end  
            k = findstr(THF,'d');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'e');
            g = findstr(THF,'e+');
            h = findstr(THF,'e-');
            if(g>=1)
            else
                if(h>=1)
                else
                    if(k>=1)
                        iflag=1;
                    end
                end
            end
            k = findstr(THF,'f');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'g');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'h');
            if(k>=1)
                iflag=1;
            end  
            k = findstr(THF,'i');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'j');
            if(k>=1)
                iflag=1;
            end       
            k = findstr(THF,'k');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'l');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'m');
            if(k>=1)
                iflag=1;
            end  
            k = findstr(THF,'n');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'o');
            if(k>=1)
                iflag=1;
            end       
            k = findstr(THF,'p');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'q');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'r');
            if(k>=1)
                iflag=1;
            end  
            k = findstr(THF,'s');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'t');
            if(k>=1)
                iflag=1;
            end   
            k = findstr(THF,'u');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'v');
            if(k>=1)
                iflag=1;
            end  
            k = findstr(THF,'w');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'x');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'y');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'z');
            if(k>=1)
                iflag=1;
            end    
            k = findstr(THF,'A');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'B');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'C');
            if(k>=1)
                iflag=1;
            end  
            k = findstr(THF,'D');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'E');
            g = findstr(THF,'E+');
            h = findstr(THF,'E-');      
            k = findstr(THF,'F');
            if(g>=1)
            else
                if(h>=1)
                else
                    if(k>=1)
                        iflag=1;
                    end
                end
            end          
            k = findstr(THF,'G');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'H');
            if(k>=1)
                iflag=1;
            end  
            k = findstr(THF,'I');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'J');
            if(k>=1)
                iflag=1;
            end       
            k = findstr(THF,'K');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'L');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'M');
            if(k>=1)
                iflag=1;
            end  
            k = findstr(THF,'N');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'O');
            if(k>=1)
                iflag=1;
            end       
            k = findstr(THF,'P');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'Q');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'R');
            if(k>=1)
                iflag=1;
            end  
            k = findstr(THF,'S');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'T');
            if(k>=1)
                iflag=1;
            end   
            k = findstr(THF,'U');
            if(k>=1)
                iflag=1;
            end
            k = findstr(THF,'V');
            if(k>=1)
                iflag=1;
            end  
            k = findstr(THF,'W');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'X');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'Y');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'Z');
            if(k>=1)
                iflag=1;
            end    
            k = findstr(THF,'/');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'\');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'*');
            if(k>=1)
                iflag=1;
            end     
            k = findstr(THF,'%');
            if(k>=1)
                iflag=1;
            end    
            k = findstr(THF,'=');
            if(k>=1)
                iflag=1;
            end 
            k = findstr(THF,'#');
            if(k>=1)
                iflag=1;
            end  
            k = findstr(THF,'=');
            if(k>=1)
                iflag=1;
            end   
%  
            if(iflag==0)
%
                k = findstr(THF,'0');
                if(k>=1)
                    iflag=2;
                end     
                k = findstr(THF,'1');
                if(k>=1)
                    iflag=2;
                end     
                k = findstr(THF,'2');
                if(k>=1)
                    iflag=2;
                end     
                k = findstr(THF,'3');
                if(k>=1)
                    iflag=2;
                end  
                k = findstr(THF,'4');
                if(k>=1)
                    iflag=2;
                end         
                k = findstr(THF,'5');
                if(k>=1)
                    iflag=2;
                end 
                k = findstr(THF,'6');
                if(k>=1)
                    iflag=2;
                end  
                k = findstr(THF,'7');
                if(k>=1)
                    iflag=2;
                end 
                k = findstr(THF,'8');
                if(k>=1)
                    iflag=2;
                end  
                k = findstr(THF,'9');
                if(k>=1)
                    iflag=2;
                end          
            end
%
            if(iflag==2)
                clear aaa;
                aaa = sscanf(THF,'%g');
                aaa=aaa';
                mdata(j,:)=aaa;
                j=j+1;
            end
%
end
disp(' ');
disp(' Data stored in Matlab matrix:  mdata ');
disp(' ');
disp(' View mdata ?');
disp(' 1=yes  2=no ');
iv=input(' ');
if(iv==1)
    mdata
end
sn=size(mdata);
sz=sn(2);
%
clear mdata1;
clear mdata2;
clear mdata3;
clear mdata4;
clear mdata5;
clear mdata6;
clear mdata7;
clear mdata8;
clear mdata9;
clear mdata10;
clear mdata11;
clear mdata12;
clear mdata13;
clear mdata14;
clear mdata15;
clear mdata16;
%
disp(' ');
disp(' Matlab array names: ');
disp(' ');
%
if(sz>=2)
    mdata1=[mdata(:,1),mdata(:,2)];
    disp(' mdata1');
end    
if(sz>=3)
    mdata2=[mdata(:,1),mdata(:,3)];
    disp(' mdata2');  
end   
if(sz>=4)
    mdata3=[mdata(:,1),mdata(:,4)];
    disp(' mdata3'); 
end   
if(sz>=5)
    mdata4=[mdata(:,1),mdata(:,5)];
    disp(' mdata4'); 
end   
if(sz>=6)
    mdata5=[mdata(:,1),mdata(:,6)];
    disp(' mdata5');  
end   
if(sz>=7)
    mdata6=[mdata(:,1),mdata(:,7)];
    disp(' mdata6');   
end   
if(sz>=8)
    mdata7=[mdata(:,1),mdata(:,8)];
    disp(' mdata7');  
end  
if(sz>=9)
    mdata8=[mdata(:,1),mdata(:,9)];
    disp(' mdata8');  
end   
if(sz>=10)
    mdata9=[mdata(:,1),mdata(:,10)];
    disp(' mdata9');  
end  
if(sz>=11)
    mdata10=[mdata(:,1),mdata(:,11)];
    disp(' mdata10');  
end  
if(sz>=12)
    mdata11=[mdata(:,1),mdata(:,12)];
    disp(' mdata11');  
end  
if(sz>=13)
    mdata12=[mdata(:,1),mdata(:,13)];
    disp(' mdata12');  
end  
if(sz>=14)
    mdata13=[mdata(:,1),mdata(:,14)];
    disp(' mdata13');  
end  
if(sz>=15)
    mdata14=[mdata(:,1),mdata(:,15)];
    disp(' mdata14');  
end  
if(sz>=16)
    mdata15=[mdata(:,1),mdata(:,16)];
    disp(' mdata15');  
end  
if(sz>=17)
    mdata16=[mdata(:,1),mdata(:,17)];
    disp(' mdata16');  
end 