Home > lattice > parseargs.m

parseargs

PURPOSE ^

PARSEARGS Check and expands optional argument lists

SYNOPSIS ^

function varargout = parseargs(default_values,args)

DESCRIPTION ^

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = parseargs(default_values,args)
0002 %PARSEARGS Check and expands optional argument lists
0003 %ARGOUT=PARSEARGS(DEFAULT_VALUES,ARGIN)
0004 %[ARG1,ARG2,...]=PARSEARGS(DEFAULT_VALUES,ARSIN)
0005 
0006 na=min(length(default_values),length(args));
0007 ok=~cellfun(@(arg) isempty(arg)&&isnumeric(arg),args(1:na));
0008 default_values(ok)=args(ok);
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