pb_initializetoolbox.m 1.46 KB
Newer Older
Jesse Heckman's avatar
Jesse Heckman committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
function pb_initializetoolbox()
% PB_INITIALIZETOOLBOX()
%
% Initializes PBToolbox.
%
% PB_INITIALIZETOOLBOX()  ...
%
% See also ...
 
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
   
   cdp   = cd; 
   startupf = 'startup.m';
   fstartup = which(startupf);
   
   clc; disp('Initializing ProgrammeerBeerToolbox...');
   
   pbpath = strrep(which('pb_initializetoolbox.m'),'pb_initializetoolbox.m','');
Jesse Heckman's avatar
Jesse Heckman committed
19
   text = fileread([pbpath 'documentation' filesep 'templates' filesep 'template_startup.txt']);
Jesse Heckman's avatar
Jesse Heckman committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
   
   disp([newline '   - localising startup.m']);
   if isempty(fstartup)
      cd(userpath);
      fid     = fopen(startupf, 'wt+');
      fprintf(fid,'%s\n', text);
      fclose(fid);
   else
      startuptext = fileread(fstartup);
      if ~contains(startuptext,text)
         fid     = fopen(fstartup, 'at+');
         fprintf(fid,'\n\n');
         fprintf(fid,'%s\n', text);
         fclose(fid);
      end
   end   
   disp('   - writing startup.m');
   
   startup;
39
   pb_datadir;       % select your data path
Jesse Heckman's avatar
Jesse Heckman committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53
   cd(cdp);
   clc; disp(['ProgrammeerBeerToolbox was succesfully initialized...' newline])
end



 
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % 
%                                                           %
%       Part of Programmeer Beer Toolbox (PBToolbox)        %
%       Written by: Jesse J. Heckman (2018)                 %
%                                                           %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %