Home > lattice > getargs.m

getargs

PURPOSE ^

GETARGS Check and expands optional argument lists

SYNOPSIS ^

function varargout = getargs(args,default_values)

DESCRIPTION ^

GETARGS Check and expands optional argument lists
ARGOUT=GETARGS(ARGIN,DEFAULT_VALUES)
[ARG1,ARG2,...]=GETARGS(ARGIN,DEFAULT_VALUES)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = getargs(args,default_values)
0002 %GETARGS Check and expands optional argument lists
0003 %ARGOUT=GETARGS(ARGIN,DEFAULT_VALUES)
0004 %[ARG1,ARG2,...]=GETARGS(ARGIN,DEFAULT_VALUES)
0005 
0006 na=min(length(default_values),length(args));
0007 valid=~cellfun(@(arg) isempty(arg)&&isnumeric(arg),args(1:na));
0008 default_values(valid)=args(valid);
0009 if nargout==length(default_values)
0010     varargout=default_values;
0011 else
0012     varargout{1}=default_values;
0013 end
0014 end

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005