0001 function uninstall_LUKE(pathforstartup)
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 if nargin == 0,
0010     pathforstartup = which('startup.m');
0011     
0012     if isempty(pathforstartup),
0013         fid = -2;
0014     else
0015         fid = fopen(pathforstartup,'r');  
0016     end
0017     
0018     if fid <= -1,
0019         if fid == -2,
0020             disp(['No startup.m found in path']);
0021         else
0022             disp(['Cannot write to startup.m, no permission.']);
0023         end
0024         disp(['Looking for a startup.m file in home or pathdef.m directory.']);
0025         
0026         if strcmp(computer,'PCWIN'),
0027             pathforstartup = which('pathdef.m');
0028             pathforstartup = pathforstartup([1:findstr(pathforstartup,'pathdef.m')-1]);
0029         else
0030             pathforstartup = '~/';
0031         end
0032         
0033     else
0034         pathforstartup = pathforstartup([1:findstr(pathforstartup,'startup.m')-1]);
0035         fclose(fid);
0036     end    
0037     
0038 end
0039 
0040 if strcmp(pathforstartup(end),'/');
0041     startuppath = [pathforstartup,'startup.m'];
0042 else
0043     startuppath = [pathforstartup,'/startup.m'];
0044 end
0045 
0046 if exist(startuppath),
0047     flag = 0;
0048     fid = fopen(startuppath,'r');  
0049     sfile = fread(fid);
0050     
0051     sf1 = strfind(char(sfile'),'%%%%%%%%%%%%%%%%%%%BEGIN-LUKE-PATH%%%%%%%%%%%%%%%%%%%');
0052     sf2 = strfind(char(sfile'),'%%%%%%%%%%%%%%%%%%%%END-LUKE-PATH%%%%%%%%%%%%%%%%%%%%');
0053     while length(sf1)>0
0054         sfile = sfile([1:max(1,sf1(1)-1),sf2(1)+53:length(sfile)]);
0055         sf1 = strfind(char(sfile'),'%%%%%%%%%%%%%%%%%%%BEGIN-LUKE-PATH%%%%%%%%%%%%%%%%%%%');
0056         sf2 = strfind(char(sfile'),'%%%%%%%%%%%%%%%%%%%%END-LUKE-PATH%%%%%%%%%%%%%%%%%%%%');
0057     end
0058     fclose(fid);
0059     fid = fopen(startuppath,'w');  
0060     fwrite(fid,sfile);
0061     fclose(fid); 
0062 end
0063 
0064 disp(['The startup.m file has been cleaned from LUKE path']);
0065 
0066 path_LUKE = [pwd,'/'];
0067 
0068 
0069 
0070 mex_clean_luke(path_LUKE)
0071 
0072 cd([path_LUKE,'Project_DKE/Database']);
0073 remove_all;
0074 cd(path_LUKE);
0075 
0076 
0077 
0078 if exist('Documentation') == 7,
0079     rmdir('Documentation','s');
0080     disp(['The Documentation folder has been removed.']);
0081 end
0082 
0083 
0084 
0085 setpath_luke_jd
0086 
0087 disp(['The LUKE paths have been removed.']);
0088 
0089 
0090 
0091 
0092 
0093