| 1 | % | 
| 2 | % [] = PV_CHECKPATH() | 
| 3 | % | 
| 4 | % This function detects where the package gmaze_pv is installed | 
| 5 | % (the upper level directory where the function volbet2iso | 
| 6 | % is found) and ensure that sub-directories are in the path | 
| 7 | % | 
| 8 |  | 
| 9 | function [] = pv_checkpath() | 
| 10 |  | 
| 11 | % Windows/Linux compatibility | 
| 12 | global sla | 
| 13 | sla = '/'; | 
| 14 | if ispc , sla = '\'; end | 
| 15 |  | 
| 16 |  | 
| 17 | % Determine the directory name where the package is installed: | 
| 18 | w       = which('volbet2iso'); | 
| 19 | packdir = w(1:length(w)-12); | 
| 20 |  | 
| 21 |  | 
| 22 | % Try to found needed subdirectories: | 
| 23 |  | 
| 24 | subdir     = struct('name',{'subfct','test'}); | 
| 25 |  | 
| 26 | for id = 1 : size(subdir(:),1) | 
| 27 | subdirname = subdir(id).name; | 
| 28 | fullsubdir = strcat(packdir,sla,subdirname); | 
| 29 | if isempty(findstr(path,fullsubdir)) | 
| 30 | addpath(fullsubdir) | 
| 31 | end %if | 
| 32 | end %for |