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

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 > read_csv

read_csv

カンマ区切り形式のファイルを読み込む

呼び出し手順

M = read_csv(fname [,sep])

パラメータ

fname

文字列. ファイルのパス.

sep

文字列. 使用するフィールドセパレータ, デフォルト値は ","

M

文字列の行列.

説明

例えば表計算ソフトウエアで"テキストおよびカンマ"形式で 作成した,フィールドのデリミタを有するアスキーファイルを 指定すると,read_csv(fname) は対応する Scilabの文字列行列を返します. セパレータを変更するには, read_csv(fname,sep) としてください.

注意: 文字列変数を数値変数に変換するために 関数 evstrによりMの全体あるいは一部を評価することができます.

// タブ区切りのデータを有するファイルを作成
A = 1:50;
mputl(strcat(string(A),ascii(9)), TMPDIR + '/foo.csv');

// csvファイルを読み込む
B = read_csv(TMPDIR + '/foo.csv');

// eval B
C = evstr(B);

// もとのデータと結果を比較
and(A == C)

参照

  • write_csv — カンマ区切り形式でファイルに書き込む
  • evstr — 式の評価

Authors

Allan CORNET
<< Spreadsheet Spreadsheet readxls >>

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:
Wed Oct 05 12:13:00 CEST 2011