NC_ExportDataΒΆ
NC_ExportData converts UniPlot data files (.nc, .nc2) into another data format.
-
svExportNames = NC_ExportData(svNCNames, ssType, ssOutDir, svSep, ssMissing, bOverwrite)
-
svExportNames = NC_ExportData(ncid, ssType, ssOutDir, svSep, ssMissing, bOverwrite)
-
svExportNames = NC_ExportData(svNCNames, ssType, obj)
-
svExportNames = NC_ExportData(ncid, ssType, obj)
Return Value
Is a string vector of the exported files. In case of an error, the function returns an empty string.
Parameters
-
svNCNames
svNCNames is a string vector with NC data file names. The file name will be used to create the export file name. The file name extention depends on the export type.
-
ssType
ssType is a scalar string with a value from the first column of the following table:
Type Extension Description CSV .csv oder .txt Text file without header data with one of the following field separators (comma, semicolon, Tab) CSV-UTX .utx Text file with header data in the UTX format XLS .xls Excel file without header data with a maximum of 16384 rows and 255 channels XLS-UTX .xls Excel file with header data in the UTX with a maximum of 16384 rows and 255 channels XLSX .xlsx Excel format with header data in Excel 2007 format XLSX-NOHEADER .xlsx Excel format without header data in Excel 2007 format XLSX-UTX .xlsx Excel format with header data in the UTX format in Excel 2007 format TDM .tdm TDM format (National Instruments Format) NC .nc netCDF format. NC-UP .nc2 UniPlot format. MATLAB .mat MATLAB Format 5 MDF4 .mf4 ASAM MDF4 format
-
obj
obj is a replacement for the parameters 3, 4, 5 and 6. obj is an object with the following elements:
Element Description obj.ssFieldSeparator Field separator, e. g. semicolon ( ;
). Default value is the country setting.obj.ssDecimalSeparator Decimal separator: .
or,
. Default value is the country setting.obj.ssMissing Text for invalid values, Default value is "*****"
.obj.bOverwriteFile TRUE (1): Target file will be overwritten. Default value is TRUE (1). obj.svChannel If set to an empty string ""
all channels will be exported; or a list with channel names. Channels, missing in the nc file will be created in the export file with missing values. Default value is an empty string (""
).obj.ssOutDir Export directory. If set to an empty string, the export file will be saved in the directory of the nc file. Default value is an empty string ( ""
).If an element is not set in the object, the default value will be used.
-
ssOutDir
Is the name of a output directory or an empty string. If ssOutDir is an empty string, the exported files will be saved in the directory of the NC source files.
-
svSep
Is a string vector with two elements. The first element is the field separator and the second element is the decimal separator: Examples:
[";", ","]
or["\t", "."]
or[",", "."]
. Only used with CSV export.
-
ssMissing
Is a text to display invalid numbers. Only used with CSV and Excel export.
-
bOverwrite
If bOverwrite is TRUE (1), existing export files will be replaced.
Example
def MyCSVExport()
{
svFiles = GetOpenFileName("", "Data Files (*.nc;*.nc2)|*.nc;*nc2|", 1, 1);
if (svFiles[1] == "") {
return;
}
obj = [.]
ssType = "XLSX";
obj.ssOutDir = "d:/";
obj.ssMissing = "";
obj.ssFieldSeparator = ",";
obj.ssDecimalSeparator = ".";
obj.bOverwrite = TRUE;
obj.svChannel = ["Lst", "EngPwr", "Speed", "PME"];
ShowWaitCursor(TRUE);
svReturn = NC_ExportData(svFiles, ssType, obj);
ShowWaitCursor(FALSE);
return svReturn;
}
History
Version | Description |
---|---|
R2014.3 | Export format XLSX-NOHEADER added. |
5.14.7 | New parameter obj. |
5.9.3 | New. |
id-883032