Sparse Grid Interpolation Toolbox Previous page

spget

Get sparse grid interpolation OPTIONS parameters.

Syntax

VAL = spget(OPTIONS, 'NAME')
VAL = spget(OPTIONS, 'NAME', DEFAULT)

Description

VAL = spget(OPTIONS, 'NAME') Extracts the value of the property NAME from the sparse grid options structure OPTIONS, returning an empty matrix if the property value is not specified in OPTIONS. It is sufficient to type only the leading characters that uniquely identify the property. Case is ignored for property names. [] is a valid OPTIONS argument.

VAL = spget(OPTIONS, 'NAME', DEFAULT) Extracts the named property as above, but returns VAL = DEFAULT if the named property is not specified in OPTIONS.

Examples

Assume that an options structure has been created using the spset command:

options = spset('GridType', 'Maximum', 'MaxDepth', 4)
options = 
              GridType: 'Maximum'
                RelTol: []
                AbsTol: []
            Vectorized: []
              MinDepth: []
              MaxDepth: 4
     VariablePositions: []
       NumberOfOutputs: []
           PrevResults: []
       FunctionArgType: []
    KeepFunctionValues: []
              KeepGrid: []
     DimensionAdaptive: []
             MinPoints: []
             MaxPoints: []
        DimadaptDegree: []
         SparseIndices: []

Using spget, we can extract the contents of the structure:

gridType = spget(options, 'GridType')
gridType =
Maximum

By using the third argument, we can set a default in case the according property of the structure is empty:

minDepth = spget(options, 'MinDepth')
minDepth = spget(options, 'MinDepth', 2)
minDepth =
     []

minDepth =
     2

Note that the default argument has no effect if the accessed property contains a value.

gridType = spget(options, 'GridType', 'Clenshaw-Curtis')
gridType =
Maximum

See Also

spset.