databank.copy
(+databank)
Copy fields of source databank to target databank
Syntax
targetDb = databank.copy(sourceDb, ...)
Input Arguments
sourceDb
[ struct | Dictionary ]
Source databank from which some (or all) fields will be copied over to the
targetDb
.
Options
SourceNames=@all
[ @all
| cellstr | string ]
List of fieldnames to be copied over from the
sourceDb
to thetargetDb
;@all
means all fields existing in thesourceDb
will be copied.
TargetDb=@empty
[ @empty
| struct | Dictionary ]
Target databank to which some (or all) fields form the
sourceDb
will be copied over;@empty
means a new empty databank will be created of the same type as thesourceDb
(either a struct or a Dictionary).
TargetNames=@auto
[ cellstr | string | function_handle ]
Names under which the fields from the
sourceDb
will be stored in thetargetDb
;@auto
means theTargetNames
will be simply the same as theSourceNames
; ifTargetNames
is a function, the target names will be created by applying this function to each of theSourceNames
.
Transform={}
[ empty | function_handle | cell ]
Transformation function or functions applied to each of the fields being copied over from the
sourceDb
to thetargetDb
; if empty, no transformation is performed; if a cell array of functions, each function will be applied consecutively.
WhenTransformFails='Error'
[ 'Error'
| 'Warning'
| 'Silence'
]
Action to be taken if the transformation function
Transform=
evaluates to an error when applied to one or more fields of the source databank.
Output Arguments
targetDb
[ struct | Dictionary ]
Target databank to which some (or all) fields from the
sourceDb
will be copied over.