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

Change language to:
English - 日本語 - Português - Русский

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

Aide Scilab >> Entrées/Sorties > write


write in a formatted file

Calling Sequence




character string specifying the file name or integer value specifying logical unit (see file).

This function can not open a UTF filename. In this case, please uses mopen.


real matrix or column vector of character strings.


character string, specifies a "Fortran" format. This character string must begin with a right parenthesis and end with a left parenthesis. Formats cannot mix floating point , integer or character edition modes


integer vector


writes row-by-row a real matrix or a column vector of character strings in a formatted file. Each row of the a argument begin in a new line of file-desc file. Depending on format a given row of the a argument may be written in more than one line of file-desc file.

Format examples : (1x,e10.3,5x,3(f3.0)) , (10x,a20) ;

See a Fortran book for more precision.

Direct access files : x=write(file_desc,a,k,format). Here k is the vector of records (one record by row, i.e. m=prod(size(k))

write(%io(2),....) writes on Scilab's window. Note that in this case format should produce one output line per matrix row. If this contraint is not verified unpredictable behavior could happen.


if getos() == 'Windows' then unix('del asave');
else unix('rm -f asave'); end
A=rand(5,3); write('asave',A); A=read('asave',5,3);
write(%io(2),A,'('' | '',3(f10.3,'' | ''))')

if getos() == 'Windows' then unix('del foo');
else unix('rm -f foo'); end

See Also

  • read — matrices read
  • save — Save a variable or a serie of variables in a binary file
  • file — file management
  • fileinfo — provides information about a file
  • writb — fortran file binary write
  • print — prints variables in a file
  • string — conversion en chaîne de caractères
  • mfprintf — converts, formats, and writes data to a file
  • mprintf — converts, formats, and writes data to the main scilab window
  • msprintf — converts, formats, and writes data in a string
  • fprintfMat — writes a matrix in a file
Report an issue
<< writb Entrées/Sorties write4b >>

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:
Mon Oct 01 17:37:22 CEST 2012