Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.0 - Português

Change language to:
English - Français - 日本語 -

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

Manual Scilab >> Planilhas > read_csv

read_csv

Read comma-separated value file

Calling Sequence

M = read_csv(fname [,sep])

Arguments

fname

a character string. The file path.

sep

a character string. Field separator used, default value is ",".

ascii(9) or "\t" for a tabulation separator are accepted.

M

a matrix of strings.

Description

Given an ascii file with delimited fields, for instance created by a spreadsheet using "Text and comma" format, read_csv(fname) returns the corresponding Scilab matrix of strings. Use read_csv(fname,sep) for another choice of separator.

Note: You may eval all or part of M using function evstr in order to convert string variables into numeric variables.

Examples

// create a file with some data separated with tab    
A = 1:50;
mputl(strcat(string(A),ascii(9)), TMPDIR + '/foo.csv');

// read csv file
B = read_csv(TMPDIR + '/foo.csv');

// eval B
C = evstr(B);

// compares original data and result
and(A == C)

See Also

Authors

Allan CORNET
<< xls_read Planilhas write_csv >>

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 Jan 26 16:24:42 CET 2011