<< DI_show dataint Deprecated >>

dataint >> dataint > DI_writedat

DI_writedat

Exports numerical data stored in a matrix variable to a text data file interactively.

Calling Sequence

[exitID] = DI_writedat(datMat)
[exitID] = DI_writedat(datMat, path)

Parameters

datMat:

name of the matrix variable you want to store in a file

path:

a string, target path for the file selector (OPTIONAL)

exitID:

an integer, exit codes, 0=OK, -1, -2, -3, -4=error codes, see below.

Description

Write a Scilab matrix of doubles to a CSV or other text-based file interactively. If you do not specify a file-extension explicitly, ".txt" is added automatically.

path:

You can commit an optional path to the function. This is used to open the file selector at the committed target path. If you omit it your home directory is set as the target path.

datMat:

This is the name of the matrix variable which contents the data you want to export.

exitID:

The exitID gives a feedback what happened inside the function. If something went wrong datMat is always [] (empty). To handle errors in a script you can evaluate exitID's error codes (negative numbers):

  • 0: Everything is OK. Matrix datMat was created

  • -1: User canceled file selection

  • -2: User canceled parameter dialog box

  • -3: Cannot write CSV file

  • -4: No matrix variable name specified

Export Parameter:

Field Separator:

This is the character which separates the fields and numbers, resp. In general CSV-files it is the comma (,), in European ones it is often the semicolon (;). Sometimes it is a tabulator (tab) or a space (space). E.g. to specify a tabulator as the separator, type in the word "tab" without quotes.

If you select space just ONE space character delimits the data.

Decimal separator:

The character which identifies the decimal place. In general CSV files it is the point (.), in most European ones it is the comma (,).

Comment header:

Place a comment in the first line/row of the file. This is useful to describe your data. Just one line is supported (OPTIONAL).

Examples

dat = [32.4 34.6 36.5 32.6 ; 102.4 105.0 104.8 102.6];
// Open the file selector at the current directory
// and write matrix "dat" to the specified csv-file
[exitID] = DI_writedat(dat, pwd());
disp("Exit-ID: " + string(exitID)) // Displays exit code

See also

Authors


Report an issue
<< DI_show dataint Deprecated >>