Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.4.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.
However, this page did not exist in the previous stable version.

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

fprintf

C言語のfprintf関数のエミュレーション

呼び出し手順

fprintf(file,format,value_1,..,value_n)

パラメータ

format

Scilab 文字列. リテラル文字と変換指定子を組み合わせた文字列を指定.

value_i

フォーマットパラメータに基づき変換されるデータを指定.

str

文字列の列ベクトル

file

ファイル名または論理ユニット番号を指定する Scilab文字列 (file参照)

file=0の場合, メッセージは標準エラーストリーム(stderr)に出力されます.

説明

古い関数であり, C言語のfprintfの機能との互換性がはるかに高い mfprintf関数の使用を推奨します.

fprintf 関数は, formatパラメータの制御の下で valueパラメータを変換,整形し, fileパラメータで指定されたファイルに 書き込みます.

format パラメータは 以下の2つの型のオブジェクトを有します:

リテラル文字

出力ストリームにコピーする文字.

変換指定子

各々は,1個以上のアイテムを valueパラメータのリストから取得します. 詳細は printf_conversion を 参照ください.

formatを全て処理した後, valueがまだ残っている場合, それらは無視されます.

u=file('open','results','unknown') //結果ファイルを開く
t=0:0.1:2*%pi;
for tk=t
  fprintf(u,'time = %6.3f value = %6.3f',tk,sin(tk)) // 1行書き込む
end
file('close',u) //結果ファイルを閉じる

fprintf(0,'My error which is going to be displayed on the stderr')

参照

  • mfprintf — 変換,整形し,ファイルにデータを書き込む
  • string — 文字列に変換
  • print — 変数をファイルに出力する
  • write — フォーマットされたファイルに書き込む
  • format — 数値の印字および表示形式
  • disp — 変数を表示
  • file — ファイル管理
  • mprintf — 変換, 整形し, Scilab主ウインドウにデータを書き込む
  • msprintf — データを変換,整形し,文字列に書き込む
  • printf_conversion — mprintf, msprintf, mfprintf 変換仕様
Report an issue
<< findfiles Files : Input/Output functions fprintfMat >>

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:
Mon Oct 01 17:40:33 CEST 2012