Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.0 - Português

Change language to:
English - Français - 日本語 -

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

Manual Scilab >> Arquivos : funções de Entrada/Saída > mfprintf

mfprintf

converts, formats, and writes data to a file

Calling Sequence

mfprintf(fd,format,a1,...,an);

Arguments

fd

scalar, file descriptor given by mopen (it's a positive integer).

if fd equals 0 redirection in stderr.

if fd equals 6 redirection in stdout.

OBSOLETE :The value -1 refers to the default file ( i.e the last opened file).

format

a Scilab string describing the format to use to write the remaining operands. The format operand follows, as close as possible, the C printf format operand syntax.

str

a character string, string to be scanned.

a1,...,an

Specifies the data to be converted and printed according to the format parameter.

Description

The mfprintf function is a interface for C-coded version of fprintf functions.

The mfprintf function writes formatted operands to the file specified by the file desciptor fd. The argument operands are formatted under control of the format operand.

this function may be used to output column vectors of numbers and string vectors without an explicit loop on the elements. In that case this function iterates on the rows. The shortest vector gives the number of time the format has to be iterated.

An homogeneous sequence of identical type parameters can be replaced by a matrix

Examples

fd = mopen(TMPDIR+'/text.txt','wt');
mfprintf(fd,'hello %s %d.\n','world',1);
mfprintf(fd,'hello %s %d.\n','scilab',2);
mclose(fd);
if (isdef('editor') | (funptr('editor')<>0)) then
  editor(TMPDIR+'/text.txt')
end
mfprintf(0,'stderr output.\n');
mfprintf(6,'stdout output.\n');
<< merror Arquivos : funções de Entrada/Saída mscanf >>

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:
Wed Jan 26 16:24:39 CET 2011