Exports numerical data stored in a matrix variable to a CSV file interactively
[exitID] = DI_writecsv(csvMat) [exitID] = DI_writecsv(csvMat, path)
a string, name of the matrix variable you want to store in a file
a string, target path for the file selector (OPTIONAL)
an integer, exit codes, 0=OK, -1, -2, -3, -4=error codes, see below.
Write a Scilab matrix of doubles to a CSV or other text-based file interactively.
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.
This is the name of the matrix variable which contents the data you want to export.
The exitID gives a feedback what happened inside the function. If something went wrong csvMat is always [] (empty). To handle errors in a script you can evaluate exitID's error codes (negative numbers):
0: Everything is OK. Matrix csvMat 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:
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.
The character which indentifies the decimal place. In general CSV files it is the point (.), in most European ones it is the comma (,).
Place a comment in the first line/row of the file. This is useful to describe your data. Just one line is supported (OPTIONAL).