writes real numbers or strings in the console or in a formatted file
write(file_desc, a) write(file_desc, a, format) write(file_desc, a, k, format)
- a character string specifying the file name. Trying to overwrite an existing file will yield an error.
- or the integer id of a file opened with
file(…)(see file). Using
%io(2)will write in the console.
This function can not open a UTF filename. In this case, please uses mopen.
Matrix of real numbers, or column of character strings.
character string specifying a "Fortran" format. It must begin with a left parenthesis and end with a right one. The
formatmust be about only one type of input data. It can't mix placeholders for real numbers and for strings.
Format examples :
Please see a Fortran book for more information.
"x": white space. "5x" = 5 white spaces "a": string. "a20" = 20 first characters of the input string. "i": print as integer "f": real number "e": real number in exponential form. "(…)": group. 3(…) = iterate 3 times the group.
writes row-by-row a real matrix or a column vector of character
strings in a formatted file. Each row of the
begin in a new line of
file_desc file. Depending on
format a given row of the
may be written in more than one line of
Direct access files :
k is the vector of records (one record by row, i.e.
write(%io(2),....) writes on Scilab's console.
Note that in this case
format should produce one output
line per matrix row. If this constraint 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,'' | ''))') write(%io(2),string(1:10)) write(%io(2),strcat(string(1:10),',')) write(%io(2),1:10,'(10(i2,3x))') if getos() == 'Windows' then unix('del foo'); else unix('rm -f foo'); end write('foo',A)
- save — Saves some chosen variables in a binary data file
- writb — fortran file binary write
- file — file management
- fileinfo — provide information about some files of any type
- print — prints variables in a file
- mfprintf — converts, formats, and writes data to a file
- mprintf — converts, formats, and writes data to the main scilab window
- fprintfMat — writes a matrix in a file
|Report an issue|
|<< writb||Entrées/Sorties||write4b >>|