Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.2 - Français

Change language to:
English - 日本語 - Português

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Aide Scilab >> Tableur > write_csv

write_csv

Write comma-separated value file

Calling Sequence

write_csv(M, filename [,sep, dec])

Arguments

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 a ','

Description

write_csv(M, filename) writes matrix M into filename as comma-separated values. The filename input is a string.

if the file 'filename' already exists, it is overwritten.

Examples

// save a matrix as csv file format
A = [1:10] * 0.1;
write_csv(A, TMPDIR + '/datas.csv');

// read as text
mgetl(TMPDIR + '/datas.csv')

r = read_csv(TMPDIR + '/datas.csv',ascii(9));
r = strsubst(r,',','.');
evstr(r)

A = [1:10] * 0.1; 
write_csv(A', TMPDIR+'/foo.csv', ' ', '.');
mgetl(TMPDIR+'/foo.csv')

See Also

  • read_csv — Read comma-separated value file
  • evstr — évaluation d'une expression
  • mgetl — read lines from an text file
  • format — number printing and display format

Authors

Allan CORNET
<< readxls Tableur xls_open >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu May 12 11:45:01 CEST 2011