initWorkspaceGPMulticlass.m 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. function initWorkspaceGPMulticlass
  2. % function initWorkspaceGPMulticlass
  3. %
  4. % BRIEF
  5. % Add local subfolders and 3rd party libraries to Matlabs work space.
  6. %
  7. % Exemplary call from external position:
  8. % GPMULTIDIR = '/place/to/this/repository/';
  9. % currentDir = pwd;
  10. % cd ( GPMULTIDIR );
  11. % initWorkspaceGPMulticlass;
  12. % cd ( currentDir );
  13. %
  14. %
  15. % Author: Alexander Freytag
  16. %% setup paths in user-specific manner
  17. % currently we do not have any dependencies, but if we would have some,
  18. % we would add them here
  19. %% add paths which come with this repository
  20. % add main path
  21. b_recursive = false;
  22. b_overwrite = true;
  23. s_pathMain = fullfile(pwd);
  24. addPathSafely ( s_pathMain, b_recursive, b_overwrite )
  25. clear ( 's_pathMain' );
  26. % some useful tiny scripts
  27. b_recursive = true;
  28. b_overwrite = true;
  29. s_pathModel = fullfile(pwd, 'gp-model');
  30. addPathSafely ( s_pathModel, b_recursive, b_overwrite )
  31. clear ( 's_pathModel' );
  32. % some useful tiny scripts, mainly covariance functions. see the
  33. % gpml-toolbox for further alternatives.
  34. b_recursive = true;
  35. b_overwrite = true;
  36. s_pathMisc = fullfile(pwd, 'misc');
  37. addPathSafely ( s_pathMisc, b_recursive, b_overwrite )
  38. clear ( 's_pathMisc' );
  39. %% 3rd party, untouched
  40. % nothing to add here
  41. end
  42. function addPathSafely ( s_path, b_recursive, b_overwrite )
  43. if ( ~isempty(strfind(path, [s_path , pathsep])) )
  44. if ( b_overwrite )
  45. if ( b_recursive )
  46. rmpath( genpath( s_path ) );
  47. else
  48. rmpath( s_path );
  49. end
  50. else
  51. fprintf('initWSImRet - %s already in your path but overwriting de-activated.\n', s_path);
  52. return;
  53. end
  54. end
  55. if ( b_recursive )
  56. addpath( genpath( s_path ) );
  57. else
  58. addpath( s_path );
  59. end
  60. end