-
Notifications
You must be signed in to change notification settings - Fork 28
/
palm.m
81 lines (70 loc) · 2.64 KB
/
palm.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
function palm(varargin)
% Type 'palm' without arguments for help.
% _____________________________________
% Anderson M. Winkler
% FMRIB / Univ. of Oxford
% Mar/2014
% http://brainder.org
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% PALM -- Permutation Analysis of Linear Models
% Copyright (C) 2015 Anderson M. Winkler
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% This is redundant in when running as a function as all files should
% be together, but it helps when running from the shell
addpath(fileparts(mfilename('fullpath')));
% If Octave
if palm_isoctave
% Disable memory dump on SIGTERM
sigterm_dumps_octave_core(0);
% If running as a script, take the input arguments
[~,cmdname,~] = fileparts(program_invocation_name());
if ~ strcmpi(cmdname(1:6),'octave')
varargin = argv();
end
% Be sure to print to the screen immediately
page_screen_output(0);
page_output_immediately(1);
% Disable some warnings
warning('off','Octave:precedence-change');
warning('off','Octave:possible-matlab-short-circuit-operator');
warning('off','Octave:function-name-clash');
else
% This line marks the place up to nothing will be printed. It's long as
% this because if it fails, at least it's not ugly and looks
% purposeful from the outside :-)
fprintf('.......................................................................\n');
end
% This is probably redundant but fixes a bug in an old Matlab version
nargin = numel(varargin);
% Print usage if no inputs are given
if nargin == 0 || strcmp(varargin{1},'-q')
palm_help('basic');
return;
elseif nargin == 1
if any(strcmpi(varargin{1},{'-help','-?','-basic'}))
palm_help('basic');
return;
elseif strcmpi(varargin{1},'-advanced')
palm_help('advanced');
return;
elseif strcmpi(varargin{1},'-checkprogs')
palm_checkprogs;
return;
end
end
palm_help('logo');
% Now run what matters
palm_core(varargin{:});