IRIS Toolbox Reference Manual

dbsplit

Split database into mutliple databases

Syntax

[D1,D2,...,DN,D] = dbsplit(D,Rule1,Rule2,...,RuleN,...)

Input arguments

Output arguments

Options

Description

The test regexp pattern and the new name pattern in each rule work as an expression-replace pair in regexprep -- see doc regexprep. The test patterns is a regexp string where you can capture tokens (...) for use in the new name pattern, $1, $2, etc.

Example

The database D contains time series for two regions, US and EU:

D = 
    US_GDP: [40x1 tseries]
    US_CPI: [40x1 tseries]
    EU_GDP: [40x1 tseries]
    EU_CPI: [40x1 tseries]

We split the database into two separate databases, one with US data only, the other with EU data only. We also strip the time series names of the country prefixes in the new databases.

[US,EU,DD[] = dbsplit(D,{'^US_(.*)','$1'},{'^EU_(.*)','$1'})

US = 
    GDP: [40x1 tseries]
    CPI: [40x1 tseries]
EU = 
    CPI: [40x1 tseries]
    GDP: [40x1 tseries]
DD = 
struct with no fields.