.. highlightlang:: us .. index:: NC_ExportData .. _nc_exportdata: NC_ExportData ============= .. us.tag NC_ExportData ENGLISH nc.tools New593 Changed5147 Changed5400 Changed5603 :ref:`NC_ExportData` converts UniPlot data files (.nc, .nc2) into another data format. .. function:: 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) .. us.return **Return Value** Is a string vector of the exported files. In case of an error, the function returns an empty string. .. us.params **Parameters** .. uparam:: 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. .. uparam:: ncid *ncid* is a vector of ncids returned by :ref:`nc_create` or :ref:`nc_open`. .. uparam:: ssType *ssType* is a scalar string with a value from the first column of the following table: .. list-table:: :header-rows: 1 * - 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 .. uparam:: obj *obj* is a replacement for the parameters 3, 4, 5 and 6. *obj* is an object with the following elements: .. list-table:: :header-rows: 1 * - 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. .. uparam:: 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. .. uparam:: 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. .. uparam:: ssMissing Is a text to display invalid numbers. Only used with CSV and Excel export. .. uparam:: bOverwrite If *bOverwrite* is TRUE (1), existing export files will be replaced. .. us.example **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; } .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - R2014.3 - Export format XLSX-NOHEADER added. * - 5.14.7 - New parameter *obj*. * - 5.9.3 - New. .. seealso:: :ref:`overview-netcdf-files`, :ref:`fileexport-data`, :ref:`nc_create` :sub:`id-883032`