PRTools contents

PRTools manual

setdefaults

SETDEFAULTS

Set defaults for function parameters

    ARGOUT = SETDEFAULTS(ARGIN,DEF1,DEF2, ....)
    [P1,P2, ...] = SETDEFAULTS(ARGIN,DEF1,DEF2, ....)

Input
 ARGIN Cell array with function input arguments, typically VARARGIN
 DEF1 Default value for argument 1
 DEF2 Default value for argument 2

Output
 ARGOUT Cell array defaults replacing the empty input arguments
 P1 Input argument 1, replaced by its default if empty
 P2 Input argument 2, replaced by its default if empty

Description

This routine substitutes empty input parameters of a function (typically  given by VARARGIN) with the defaults DEF1, DEF2, etcetera.

PRTools contents

PRTools manual