<< dispfiles Files : Input/Output functions fscanfMat >>

Scilab Help >> Files : Input/Output functions > fprintfMat

fprintfMat

行列をファイルに書き込む

呼び出し手順

fprintfMat(file, M [,format,text])

引数

fil

文字列, 書き込むファイルのパス名

M

実数の行列

format

形式を指定する文字列. オプションのパラメータで, デフォルト値は"%lf".

サポートされる形式: %[width].[precision]type または %type, ただし:

width: 文字出力の最小数を指定するオプションの数値;

precision: 出力フィールド全てまたは一部に関する 出力される文字の最大数を指定するオプションの数値; または整数値を印字する桁の最小数;

type: lf, lg, d, i, e, f, g (詳細はscanf_conversion を参照).

text

ファイルの先頭に保存される 数値以外のコメントを指定する文字列の行(列)ベクトル.

説明

fprintfMat 関数は,整形済みのファイルに 行列を書き込みます. 行列の各行はファイルの中で1行となります. textが指定された場合, ファイルの先頭に1行に1要素/行で textの要素が要素毎に挿入されます.

n = 50;
a = rand(n, n, "u");
fprintfMat(TMPDIR + "/Mat", a, "%5.2f");
a1 = fscanfMat(TMPDIR + "/Mat");

// ファイルMat1を作成し, コメントを挿入します
some_comment = ["This is a comment","This the second line of the comment.","This is the third line of the comment."];
fprintfMat(TMPDIR + "/Mat1", a, "%5.2f",some_comment);

参照


Report an issue
<< dispfiles Files : Input/Output functions fscanfMat >>