Scilab Website | Contribute with GitLab | Scilab Community | ATOMS toolboxes
Scilab Online Help
5.3.2 - 日本語

Change language to:
English - Français - Português

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

Scilab help >> Files : Input/Output functions > mfprintf

mfprintf

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

呼び出し手順

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

パラメータ

fd

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

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

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

古い仕様 :値 -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);
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 Files : Input/Output functions mscanf >>

Copyright (c) 2022-2026 (Dassault Systèmes S.E.)
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:56 CEST 2011