gdaReadStruct¶
Purpose¶
Gets a structure from a GAUSS Data Archive.
Format¶
-
{ instance, retcode } =
gdaReadStruct
(filename, varname, structure_type)¶ Parameters: - filename (string) – name of data file.
- varname (string) – name of structure instance in the GDA.
- structure_type (string) – structure type.
Returns: - instance (struct) – instance of the struct.
- retcode (scalar) –
0 if successful, otherwise, any of the following error codes:
1 Null file name. 2 File open error. 4 File read error. 5 Invalid file type. 8 Variable not found. 10 File contains no variables. 14 File too large to be read on current platform.
Examples¶
// Create structure
struct mystruct {
matrix x;
array a;
};
struct mystruct msw;
msw.x = rndn(500, 25);
msw.a = areshape(rndn(5000, 100), 10|500|100);
// Create GDA `myfile`
ret = gdaCreate("myfile.gda", 1);
/*
** Write structure msw to `myfile`
** and store as variable ms
*/
retcode1 = gdaWrite("myfile.gda", msw, "ms");
// Declare new instance of mystruct, `msr`
struct mystruct msr;
// Read ms from GDA tp msr
{ msr, retcode2 } = gdaReadStruct("myfile.gda", "ms", "mystruct");
Remarks¶
instance can be an array of structures.
See also
Functions gdaRead()
, gdaReadSparse()
, gdaWrite()