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.
See the recommended documentation of this function

Scilab help >> Spreadsheet > write_csv

write_csv

カンマ区切り形式でファイルに書き込む

呼び出し手順

write_csv(M, filename [,sep, dec])

パラメータ

filename

文字列. ファイルパス.

M

文字列の行列.

sep

列セパレータ記号, デフォルトはタブ文字:ascii(9)または"\t"

dec

小数点記号 '.' または ','. デフォルトは ','

説明

write_csv(M, filename) は,行列Mfilenameにカンマ区切り形式で書き込みます. filename入力は文字列です .

ファイル 'filename' がすでに存在する場合, 上書きされます.

// 行列をCSVファイル形式で保存
            A = [1:10] * 0.1;
            write_csv(A, TMPDIR + '/data.tsv');
            
            // テキストとして読み込む
            mgetl(TMPDIR + '/data.tsv')
            
            r = read_csv(TMPDIR + '/data.tsv', ascii(9));
            r = strsubst(r, ',' , '.');
            evstr(r)
            
            A = [1:10] * 0.1; 
            write_csv(A', TMPDIR+'/foo.csv', ' ', '.');
            mgetl(TMPDIR+'/foo.csv')
            
            // tab-separated values
            write_csv(A, TMPDIR + '/datas.tsv');
            
            //coma-separated values
            write_csv(A, TMPDIR + '/data.csv', ';');

参照

  • read_csv — カンマ区切り形式のファイルを読み込む
  • evstr — 式の評価
  • mgetl — アスキーファイルから行を読み込む
  • format — 数値の印字および表示形式
Report an issue
<< readxls Spreadsheet xls_open >>

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:37 CEST 2012