IRIS Toolbox Reference Manual

dbbatch

Run a batch job to create new database fields

Syntax

[D,Processed,Added] = dbbatch(D,NewName,Expr,...)

Input arguments

Output arguments

Options

Description

This function is primarily meant to create new database fields, each based on an existing one. If you, on the otherhand, only wish to modify a number of existing fields without adding any new ones, use dbfun instead.

The expression Expr is evaluated in the caller workspace, and hence may refer to any variables existing in the workspace, not only to the database and its fields.

To convert the strings $0, $1, $2, etc. to lower case or upper case, use the dot or colon syntax: $.0, $.1, $.2 for ower case, and $:0, $:1, $:2 for upper case.

Failure

The function dbbatch will always fail when called on a sub-database from within a function (as opposed to a script). A sub-database is a struct within a struct, a struct within a cell array, a struct within an array of structs, etc.

function ...
    d.e = dbbatch(d.e,...);
    ...
end

function ...
    d{1} = dbbatch(d{1},...);
    ...
end

function ...
    d(1) = dbbatch(d(1),...);
    ...
end

Example

For each field (all assumed to be tseries) create a first difference, and name the new series DX where X is the name of the original series.

d = dbbatch(d,'D$0','diff(d.$0)');

Note that the original series will be presered in the database, together with the newly created ones.

Example

Suppose that in database D you want to seasonally adjust all time series whose names end with _u, and give these seasonally adjusted series names without the _u.

d = dbbatch(d,'$1','x12(d.$0)','nameFilter','(.*)u');

or, if you want to make sure only tseries objects will be selected (in case there are database entries ending with a u other than tseries objects)

d = dbbatch(d,'$1','x12(d.$0)', ...
    'nameFilter=','(.*)u','classFilter=','tseries');