writes comma-separated value file
write_csv(M, filename [,sep, dec])
:filename a character string. The file path. : :M a matrix of strings. : :sep column separator mark, by default a tabulation: ascii(9) or
“t”.
: :dec decimal mark ‘.’ or ‘,’. By default: ‘,’ :
write_csv(M, filename) writes matrix M into file filename as tab-separated values. The filename input is a string.
If the file ‘filename’ already exists, it is overwritten.
// save a matrix as csv file format
A = [1:10] * 0.1;
write_csv(A, TMPDIR + '/data.tsv');
// read as text
`mgetl`_(TMPDIR + '/data.tsv')
//tab-separated values
r = `read_csv`_(TMPDIR + '/data.tsv', `ascii`_(9));
r = `strsubst`_(r, ',' , '.');
`evstr`_(r)
A = [1:10] * 0.1;
write_csv(A', TMPDIR+'/foo.csv', ' ', '.');
`mgetl`_(TMPDIR+'/foo.csv')
//tab-separated values
write_csv(A, TMPDIR + '/datas.tsv');
//coma-separated values
write_csv(A, TMPDIR + '/datas.csv', ';');