Undefind function
fiona3668 opened this issue · 2 comments
fiona3668 commented
Dear all:
Hi! I am currently using this tool in spm, but it is failed since there is no function 'spm_subFun' in the spm source code.
It shows:
Undefined function 'spm_subFun' corresponding to input parameter of type 'cell'
Could anyone help me with this?
Best,
Fiona
JohnAshburner commented
Dear Fiona,
Here it is.
Best regards,
-John
…On Wed, 9 Sep 2020 at 07:09, zhiyuan zhang ***@***.***> wrote:
Dear all:
Hi! I am currently using this tool in spm, but it is failed since there is
no function 'spm_subFun' in the spm source code.
It shows:
Undefined function 'spm_subFun' corresponding to input parameter of type
'cell'
Could anyone help me with this?
Best,
Fiona
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#8>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACY3J63EQS3U36HK52JPVO3SE4LXZANCNFSM4RBFYCPQ>
.
--
Prof John Ashburner
Professor of Imaging Science
UCL Institute of Neurology
Queen Square
Wellcome Trust Centre for Neuroimaging
University College London
12 Queen Square, London, WC1N 3BG
E: j.ashburner@ucl.ac.uk T: +44 (0)20 3448 4365
http://www.fil.ion.ucl.ac.uk/
function varargout = spm_subfun(varargin)
% Enable calling local functions
% FORMAT [o1,o2,...] = spm_subfun(localfunctions,action,i1,i2,...)
% The funcion is supposed to be inserted into multifunction m-files
% so that it calls localfunctions within the scope of the m-file.
% The output of this is used to match the action string with the
% name of each local function to see which of them to call.
%__________________________________________________________________________
% Copyright (C) 2020 Wellcome Centre for Human Neuroimaging
% $Id$
if nargin<=1
[varargout{1:nargout}] = import(varargin{1:nargin});
else
[varargout{1:nargout}] = select(varargin{1:nargin});
end
%==========================================================================
%==========================================================================
function varargout = select(funs,opt,varargin)
opt = lower(opt);
s = import(funs);
if ~isfield(s,opt), error('Unknown function (%s)',opt); end
[varargout{1:nargout}] = feval(s.(opt),varargin{:});
%==========================================================================
%==========================================================================
function varargout = import(funs,varargin)
names = cellfun(@(x)lower(char(x)),funs,'UniformOutput',false);
c = {names{:}; funs{:}};
varargout{1} = struct(c{:});
%==========================================================================
brudfors commented
The function has now also been added to the diffeo-segment source code.