Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.0 - 日本語

Change language to:
English - Français - Português - Русский

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

Scilabヘルプ >> Files : Input/Output functions > mfprintf

mfprintf

変換,整形し,ファイルにデータを書き込む

呼び出し手順

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

引数

fd

スカラー, mopenで指定したファイル記述子 (正の整数).

fd が 0 の場合, stderr へのリダイレクション.

fdが 6 の場合, stdout へのリダイレクション.

古い仕様 :値 -1 はデフォルトのファイル ( すなわち直近にオープンされたファイル)を指します.

format

残りのオペランドを書き込む際に使用されるフォーマットを指定する Scilab 文字列. formatオペランドはCのprintf のフォーマットオペランドの構文に可能な限り似せられています.

str

文字列: スキャンされる文字列.

a1, ..., an

formatパラメータに基づき変換,出力されるデータ.

説明

mfprintf 関数は, C言語のfprintf関数への インターフェイスです.

mfprintf関数は,整形されたオペランドを ファイル記述子fdで指定したファイルに書き込みます. 引数のオペランドは,formatオペランドの制御のもとで整形されます.

この関数は数値の列ベクトルおよび文字列ベクトルを要素に関する 明示的なループ処理を行うことなく出力する際に使用することができます. この場合,この関数は行に関する反復処理を行ないます. 最も短いベクトルはフォーマットの反復回数を指定します.

同じ型パラメータの一様なシーケンスは 行列で置換することができます.

fd = mopen(TMPDIR+'/text.txt','wt');
mfprintf(fd,'hello %s %d.\n','world',1);
mfprintf(fd,'hello %s %d.\n','scilab',2);
mfprintf(fd,'This line is built with a column vector (26:28) %d.\n',[26:28].');
mfprintf(fd,'This line is built with a row vector (26:28) %d.\n',[26:28]);
A = rand(3,6);
mfprintf(fd,'This line is built with a matrix %.3f.\n',A);
mclose(fd);
if (isdef('editor') | (funptr('editor')<>0)) then
  editor(TMPDIR+'/text.txt')
end
mfprintf(0,'stderr output.\n');
mfprintf(6,'stdout output.\n');
Report an issue
<< merror Files : Input/Output functions mscanf >>

Copyright (c) 2022-2023 (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:
Tue Feb 14 15:10:31 CET 2017