-
Notifications
You must be signed in to change notification settings - Fork 5
/
cat_install_tfce.m
51 lines (48 loc) · 1.59 KB
/
cat_install_tfce.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function varargout = cat_install_tfce(install)
%
% This function will connect to the SBM server and install
% the TFCE toolbox
% ______________________________________________________________________
%
% Christian Gaser, Robert Dahnke
% Structural Brain Mapping Group (https://neuro-jena.github.io)
% Departments of Neurology and Psychiatry
% Jena University Hospital
% ______________________________________________________________________
% $Id$
if nargin == 0
install = spm_input('Install TFCE toolbox',1,'yes|no',[1 0],1);
end
if install
try
fprintf(' Download and install TFCE...\n');
d0 = spm('Dir');
d = fullfile(spm('Dir'),'toolbox');
lastwarn('');
s = unzip('http://www.neuro.uni-jena.de/tfce/tfce_latest.zip', d);
fprintf(' Success: %d files have been downloaded.\n',numel(s));
addpath(d0);
rehash
rehash toolboxcache;
if exist('toolbox_path_cache','file'), toolbox_path_cache; end
eval(['spm fmri;clear cat_version;spm_cat12']);
catch
le = lasterror;
switch le.identifier
case 'MATLAB:checkfilename:urlwriteError'
fprintf(' Update failed: cannot download file.\n');
otherwise
fprintf('\n%s\n',le.message);
end
end
[warnmsg, msgid] = lastwarn;
switch msgid
case ''
case 'MATLAB:extractArchive:unableToCreate'
fprintf(' Update failed: check folder permission.\n');
case 'MATLAB:extractArchive:unableToOverwrite'
fprintf(' Update failed: check file permissions.\n');
otherwise
fprintf(' Update failed: %s.\n',warnmsg);
end
end