9 [reg,~,nCallerStackStepsUp]=
mxberry.
core.parseparext(varargin,...
10 {
'nCallerStackStepsUp';1},
'propRetMode',
'separate');
14 if isempty(nPlaceHolders)
15 nPlaceHolders=nVarArgs;
18 if nVarArgs<nPlaceHolders
19 throwerror(
'wrongInput',[
'Values are expected to be provided for ',...
20 'each placeholder'],
'nCallerStackStepsUp',1+nCallerStackStepsUp);
23 isChar=ischar(typeSpec);
25 for iVar=1:nPlaceHolders
26 assignIn(sprintf(
'x%d',iVar),reg{iVar});
30 isOk=feval(typeSpec,reg{1:nPlaceHolders});
38 checkName=func2str(typeSpec);
40 defaultErrorMessage=...
41 [
'%s is expected to comply with all of the following ',...
44 [~,~,varNameList,errorTag,errorMessage]=
mxberry.
core.parseparext(...
45 reg((nPlaceHolders+1):end),...
47 'varNameList',
'errorTag',
'errorMessage';...
48 {},
'wrongInput',defaultErrorMessage;...
52 nVarNames=length(varNameList);
53 if nVarNames>nPlaceHolders
54 throwerror(
'wrongInput',[
'Number of variable names exceeds ',...
55 'a number of place holders'],
'nCallerStackStepsUp',...
56 1+nCallerStackStepsUp);
58 varNameList=[varNameList,cell(1,nPlaceHolders-nVarNames)];
60 for iVar=nVarNames+1:nPlaceHolders
61 varNameList{iVar}=inputname(2+iVar);
63 errorMessage=sprintf(errorMessage,...
66 throwerror(errorTag,errorMessage,
'nCallerStackStepsUp',...
67 1+nCallerStackStepsUp);
71 assignin(
'caller',varName,varValue);
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 checkmultvar(in typeSpec, in nPlaceHolders, in varargin)
CHECKMULTVAR checks a generic condition provided by typeSpec string in the following format: 'isnumer...
function assignIn(in varName, in varValue)
function iscellofstring(in inpArray)
function isstring(in inpArray)