MatrixBerryCore
checkcelloffunc.m
Go to the documentation of this file.
1 function inpArray=checkcelloffunc(inpArray,isEmptyAllowed,varargin)
2 import mxberry.core.throwerror;
3 [~,~,nCallerStackStepsUp]=mxberry.core.parseparext(...
4  varargin,...
5  {'nCallerStackStepsUp';1;...
6  'isscalar(x)&&isnumeric(x)&&isreal(x)'},0,...
7  'propRetMode','separate');
8 if nargin==1
9  isEmptyAllowed=false;
10 end
11 %
12 if ~(mxberry.core.isrow(inpArray)||isEmptyAllowed&&isempty(inpArray))
13  if ~isEmptyAllowed
14  throwerror('wrongInput',...
15  '%s is char is expected to be a row',inputname(1),...
16  'nCallerStackStepsUp',1+nCallerStackStepsUp);
17  else
18  throwerror('wrongInput',...
19  '%s is char is expected to be a row or empty cell',...
20  inputname(1),'nCallerStackStepsUp',1+nCallerStackStepsUp);
21  end
22 end
23 if isa(inpArray,'function_handle')
24  inpArray={inpArray};
25 elseif ~iscell(inpArray)
26  throwerror('wrongInput',...
27  'input array should be either function_handle or cell',...
28  'nCallerStackStepsUp',1+nCallerStackStepsUp);
29 else
30  if ~all(cellfun('isclass',inpArray,'function_handle'))
31  throwerror('wrongInput',...
32  '%s is expected to be a cell array of function_handles',...
33  inputname(1),'nCallerStackStepsUp',1+nCallerStackStepsUp);
34  end
35 end
function throwerror(in msgTag, in varargin)
THROWERROR works similarly to built-in ERROR function in case when there is no output arguments but s...
function checkcelloffunc(in inpArray, in isEmptyAllowed, in varargin)
CHECKCELLOFFUNC checks that input variable is either a function_handle of cell of function_handle (ch...