Here's a follow up to Stefano's comments on mread() and mwrite(),
for which, thanks!
Executive summary: round-tripping (writing a matrix to file using
mwrite then reading it back via mread) works correctly if you use any
of the "standard" filename extensions: ".mat" for a plain file,
".gz"
for gzip-compressed, or ".bin" for binary.
However a bug was introduced in gretl 2019b (and remained in 2019c,
though it's now fixed in git), meaning that the round-trip would not
work correctly for a matrix file given a ".txt" or ".csv" extension.
That's because:
(a) we thought it would be useful to make mread work for "generic"
delimited-text files, not conforming to gretl's specific format (in
which the number of rows and columns are given in a header line,
separated by a tab character), and
(b) we switched to this alternative reading mode when given a ".csv"
or ".txt" file, but
(c) we did _not_ change the behavior of mwrite depending on the
filename extension.
Therefore, if you did something like
matrix m = mnormal(30,3)
mwrite(m, "mymatrix.csv")
matrix check = mread("mywrite.csv")
you'd get a mess-up: gretl would write an own-format matrix file but
then try to read it back in the alternative CSV mode.
Here's what is now in git, and will be in 2019d (see the help text for
these functions for details):
* We treat ".csv" specially on both reading and writing, so
round-tripping will work OK.
* We no longer treat ".txt" specially at either end.
There's also some remedial code in place for mread, to detect
previously written ".csv" files that are in fact own-format gretl
matrix files.
Allin