1function SJget_install 2% SJget_install - Install SJget toolbox. 3% 4% Copyright 2008, Leslie Foster 5% Created Nikolay Botev March 2008 6% 5/2/2008: modified by L. Foster 7 8 % Compute path to SJget toolbox 9 pkgdir = which(mfilename); 10 i = find(pkgdir == filesep); 11 pkgdir = pkgdir(1:i(end)-1); 12 13 version_str = version; 14 idot = find(version_str == '.'); 15 version_num = str2num( version_str(1:idot(1)+1) ); 16 if version_num >= 7.2 17 % Check if already installed 18 % textscan(path,...) fails in early versions of Matlab 7 19 % so skip the check for these versions 20 pth = textscan(path, '%s', 'delimiter', pathsep); 21 pth = pth{1}; 22 if ~isempty(find(strcmpi(pth, pkgdir), 1)) 23 disp('SJget toolbox is already installed.'); 24 return; 25 end 26 end 27 28 % Add SJget package to MATLAB path 29 addpath(pkgdir); 30 31 % Download SJ_Index.mat 32 matdir = [pkgdir filesep 'mat']; 33 if ~exist(matdir, 'dir') 34 mkdir(matdir); 35 end 36 SJget; 37 38 % Done 39 disp(' ') 40 disp(' '); 41 disp('Your path has been modified by:'); 42 disp(['addpath ',pkgdir]); 43 44 disp(' '); 45 disp('SJget toolbox successfully installed.'); 46 disp('Remember to save your path using savepath or pathtool!'); 47end 48