Writes a variable to a GAUSS Data Archive.


retcode = gdaWrite(filename, x, varname)
  • filename (string) – name of data file.
  • x (matrix or array or string or string array) – data to write to the GDA.
  • varname (string) – variable name.

retcode (scalar) –

return code, 0 if successful, otherwise one of the following error codes:

1 Null file name.
2 File open error.
3 File write error.
4 File read error.
5 Invalid data file type.
9 Variable name too long.
11 Variable name must be unique.
14 File too large to be read on current platform.


// Generate random variable x
x = rndn(100, 50);

// Create GDA `myFile`
retcode1 = gdaCreate("myfile.gda", 1);

// Write `x`  to `myfile` as x1
retcode2 = gdaWrite("myfile.gda", x, "x1");


gdaWrite() adds the data in x to the end of the variable data in filename, and gives the variable the name contained in varname.

See also

Functions gdaWrite32(), gdaCreate()