NC_AddFilesΒΆ

NC_AddFiles merges NC files into a new NC file by adding data records to the destination file. Channels with identical names will be concatenated.

oError = NC_AddFiles(svNCAdd, ssNCDest)
oError = NC_AddFiles(svNCAdd, ssNCDest, svVarNames)

Return Value

Is 0, if no error occurred or an error object, see error_create.

Parameters

svNCAdd

svNCAdd is a vector with NC file names.

ssNCDest

ssNCDes is the new NC file name.

svVarNames

svVarNames is a vector with channel names.

Comment

Beginning with R2015.8 data channels which appeared in the second or subsequent files for the first time but not in the first file will now be added.

The channels must have the identical data type (NC_CHAR or number).

Beginning with R2013.10 data channels from MDF, BLF or Puma Recorder data files can be concatenated. These files normally contain data with different sampling rates. The channels with identical sampling rates are generally saved in one group (dimension).

For each file the time range is determined (t_start and t_end). The time channels of the second and all other files is corrected as follows:

t_offset = t_end[iFile] - t_start[iFile+1] + 0.1; t[i] = t[i] + t_offset;

A time channel must contain a channel attribute Type with the value Time Channel.

The time groups are matched by finding the maximum number of matching channels in all files.

The channels are selected by their names. The names in all files must be identical. For example, if one MDF file contains the group suffix in the channel names and the channels in the other file are saved without the group name, the function will fail.

The time channels will be added automatically.

Example

def _NC_AddFiles(svFiles)
{
    if (len(svFiles) < 2) {
        return auto_ImportData(svFiles[1]);
    }
    svF = svFiles;
    for (i in 1:len(svFiles)) {
        svF[i] = auto_ImportData(svFiles[i]);
    }
    svFirst = svF[1];

    svP = SplitPath(svFiles[1]);
    ssNCDest = sum(svP[1,2,3]) + "Add.nc2";
    oError = NC_AddFiles(svF, ssNCDest);
    if (type(oError) == "error") {
       MessageBoxError("%s\n\nError-No.: %d\n%s", oError.domain, oError.code, oError.message);
       return "";
    }
    return ssNCDest;
}

History

Version Description
R2015.8 Channels which appeared in the second or subsequent files for the first time but not in the first file will now be added.
R2013.10 Data files with different time groups can be concatenated.
R2013.5 New.

id-1284725